08f2a81ac1
Drops ember-radio-buttons addon and uses a plain input element instead. ember-radio-buttons doesn't seem to be maintained anymore and required jQuery. Also plain input element seems to be much easier to maintain. Replaces ember-ajax by ember-fetch as ember-ajax is build on top of jQuery.ajax(). This reduces the bundle size by 25 KB (JavaScript) after gzip. Updating the size limit accordingly.
25 lines
785 B
JavaScript
25 lines
785 B
JavaScript
import { inject as service } from '@ember/service';
|
|
import DS from 'ember-data';
|
|
import AdapterFetch from 'ember-fetch/mixins/adapter-fetch';
|
|
|
|
const { RESTAdapter } = DS;
|
|
|
|
export default RESTAdapter.extend(AdapterFetch, {
|
|
encryption: service(),
|
|
|
|
// set namespace to api.php in same subdirectory
|
|
namespace:
|
|
window.location.pathname
|
|
// remove index.html if it's there
|
|
.replace(/index.html$/, '')
|
|
// remove tests prefix which is added by testem (starting with a number)
|
|
.replace(/\/\d+\/tests/, '')
|
|
// remove tests prefix which is added by tests run in browser
|
|
.replace(/tests/, '')
|
|
// remove leading and trailing slash
|
|
.replace(/\/$/, '')
|
|
// add api.php
|
|
.concat('/api/index.php')
|
|
// remove leading slash
|
|
.replace(/^\//g, '')
|
|
});
|