mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
Fixed API path generation for multi-segmented model names
no issue - if a model name has multiple segments, eg `custom-setting` then the URL generated was `/customSettings/` rather than `/custom_settings/`
This commit is contained in:
parent
7430c28001
commit
23d7aeb764
@ -2,6 +2,7 @@ import AjaxServiceSupport from 'ember-ajax/mixins/ajax-support';
|
||||
import RESTAdapter from '@ember-data/adapter/rest';
|
||||
import ghostPaths from 'ghost-admin/utils/ghost-paths';
|
||||
import {inject as service} from '@ember/service';
|
||||
import {underscore} from '@ember/string';
|
||||
|
||||
export default RESTAdapter.extend(AjaxServiceSupport, {
|
||||
host: window.location.origin,
|
||||
@ -24,6 +25,11 @@ export default RESTAdapter.extend(AjaxServiceSupport, {
|
||||
return this.ajax(this.buildURL(type.modelName, id), 'GET', {data: query});
|
||||
},
|
||||
|
||||
pathForType() {
|
||||
const type = this._super(...arguments);
|
||||
return underscore(type);
|
||||
},
|
||||
|
||||
buildURL() {
|
||||
// Ensure trailing slashes
|
||||
let url = this._super(...arguments);
|
||||
|
Loading…
Reference in New Issue
Block a user