jeudi 11 octobre 2018

Using different ember adapters for different back end server requests

I have two adapters application.js and exam.js. The application.js works as default adapter which will make requests to the url http://localhost:8000/api/ In a different situation I need to make requests to the http://localhost:8000/exam/ url. Suggest me a feasible method to do this

/adapters/application.js

import DRFAdapter from './drf';
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';

export default DRFAdapter.extend(DataAdapterMixin,{
    authorizer: 'authorizer:custom',
    host: 'http"//localhost:8000',

    pathForType() {
        return '';
    }
});

/adapters/exam.js

import DRFAdapter from './drf';
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';

export default DRFAdapter.extend(DataAdapterMixin, {
    host: 'http://localhost:8000',
    namespace: 'exam',
    pathForType(){
        return 'e'
    }
});




Aucun commentaire:

Enregistrer un commentaire