1
0
mirror of https://github.com/flarum/core.git synced 2025-07-31 13:40:20 +02:00

Upgrade ember-cli to 0.1.4 and fix related breakage. closes #18

This commit is contained in:
Toby Zerner
2014-12-23 12:45:07 +10:30
parent 9365205ac4
commit 238bb40360
28 changed files with 225 additions and 509 deletions

View File

@@ -1,26 +1,37 @@
import Ember from 'ember';
import DS from 'ember-data';
export default DS.JsonApiAdapter.extend({
import JsonApiAdapter from 'ember-json-api/json-api-adapter';
export default JsonApiAdapter.extend({
host: '/api',
xhr: [],
ajax: function(url, type, hash) {
var adapter = this;
return new Ember.RSVP.Promise(function(resolve, reject) {
hash = adapter.ajaxOptions(url, type, hash);
hash.success = function(json) {
Ember.run(null, resolve, json);
};
hash.error = function(jqXHR, textStatus, errorThrown) {
Ember.run(null, reject, adapter.ajaxError(jqXHR));
};
adapter.xhr.push(Ember.$.ajax(hash));
}, "DS: RestAdapter#ajax " + type + " to " + url);
},
findQuery: function(store, type, query) {
var ids = null;
if (query.ids) {
ids = query.ids.join(',');
delete query.ids;
}
return this.ajax(this.buildURL(type.typeKey, ids), 'GET', {data: query});
},
});
// export default DS.JsonApiAdapter.extend({
// host: '/api',
// // xhr: [],
// // ajax: function(url, type, hash) {
// // var adapter = this;
// // return new Ember.RSVP.Promise(function(resolve, reject) {
// // hash = adapter.ajaxOptions(url, type, hash);
// // hash.success = function(json) {
// // Ember.run(null, resolve, json);
// // };
// // hash.error = function(jqXHR, textStatus, errorThrown) {
// // Ember.run(null, reject, adapter.ajaxError(jqXHR));
// // };
// // adapter.xhr.push(Ember.$.ajax(hash));
// // }, "DS: RestAdapter#ajax " + type + " to " + url);
// // },
// });