mirror of
https://github.com/discourse/discourse.git
synced 2025-02-03 06:42:01 +08:00
21 lines
575 B
JavaScript
21 lines
575 B
JavaScript
import RestAdapter from 'discourse/adapters/rest';
|
|
import { Result } from 'discourse/adapters/rest';
|
|
|
|
export default RestAdapter.extend({
|
|
|
|
find(store, type, findArgs) {
|
|
return this._super(store, type, findArgs).then(function(result) {
|
|
return {post: result};
|
|
});
|
|
},
|
|
|
|
createRecord(store, type, args) {
|
|
const typeField = Ember.String.underscore(type);
|
|
args.nested_post = true;
|
|
return Discourse.ajax(this.pathFor(store, type), { method: 'POST', data: args }).then(function (json) {
|
|
return new Result(json[typeField], json);
|
|
});
|
|
}
|
|
|
|
});
|