2020-01-08 15:58:52 +01:00
|
|
|
import RESTAdapter from '@ember-data/adapter/rest';
|
2018-12-29 01:27:37 +01:00
|
|
|
import { inject as service } from '@ember/service';
|
2014-10-30 21:44:22 +01:00
|
|
|
|
2020-10-18 22:38:37 +02:00
|
|
|
export default class ApplicationAdapter extends RESTAdapter {
|
2020-01-18 10:13:50 +01:00
|
|
|
@service
|
|
|
|
encryption;
|
2015-10-25 19:38:14 +01:00
|
|
|
|
2014-07-06 19:22:38 +02:00
|
|
|
// set namespace to api.php in same subdirectory
|
2023-10-15 20:37:03 +02:00
|
|
|
namespace = window.location.pathname
|
2014-07-06 19:22:38 +02:00
|
|
|
// remove index.html if it's there
|
|
|
|
.replace(/index.html$/, '')
|
2015-01-24 18:32:31 +01:00
|
|
|
// remove tests prefix which is added by testem (starting with a number)
|
2015-01-24 16:51:26 +01:00
|
|
|
.replace(/\/\d+\/tests/, '')
|
2015-01-24 18:32:31 +01:00
|
|
|
// remove tests prefix which is added by tests run in browser
|
|
|
|
.replace(/tests/, '')
|
2014-07-06 19:22:38 +02:00
|
|
|
// remove leading and trailing slash
|
|
|
|
.replace(/\/$/, '')
|
|
|
|
// add api.php
|
2015-08-01 18:42:48 +02:00
|
|
|
.concat('/api/index.php')
|
2014-07-06 19:22:38 +02:00
|
|
|
// remove leading slash
|
2023-10-15 20:37:03 +02:00
|
|
|
.replace(/^\//g, '');
|
2020-01-18 10:13:50 +01:00
|
|
|
}
|