2015-03-06 12:37:24 -05:00
|
|
|
import Store from "discourse/models/store";
|
|
|
|
import RestAdapter from 'discourse/adapters/rest';
|
2015-04-08 14:44:44 -04:00
|
|
|
import Resolver from 'discourse/ember/resolver';
|
2015-03-06 12:37:24 -05:00
|
|
|
|
|
|
|
let _restAdapter;
|
|
|
|
export default function() {
|
2015-04-08 14:44:44 -04:00
|
|
|
const resolver = Resolver.create();
|
2015-03-06 12:37:24 -05:00
|
|
|
return Store.create({
|
|
|
|
container: {
|
|
|
|
lookup(type) {
|
|
|
|
if (type === "adapter:rest") {
|
|
|
|
_restAdapter = _restAdapter || RestAdapter.create({ container: this });
|
|
|
|
return (_restAdapter);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-04-08 14:44:44 -04:00
|
|
|
lookupFactory(type) {
|
|
|
|
const split = type.split(':');
|
|
|
|
return resolver.customResolve({type: split[0], fullNameWithoutType: split[1]});
|
|
|
|
},
|
2015-03-06 12:37:24 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|