mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
Fixed post/page requests in Admin not including correct ?formats param
no issue - `buildQuery` method in adapters is only used for store `.query()` calls so when saving the formats param wasn't being added meaning we were losing the `lexical` field in the API response - switched to `buildURL` which is always used
This commit is contained in:
parent
6f3c18b6f4
commit
58b0a1b90d
@ -6,11 +6,20 @@ export default class Page extends ApplicationAdapter {
|
||||
return this.buildURL(modelName, id, snapshot, requestType, query);
|
||||
}
|
||||
|
||||
buildQuery(store, modelName, options) {
|
||||
if (!options.formats) {
|
||||
options.formats = 'mobiledoc,lexical';
|
||||
buildURL() {
|
||||
const url = super.buildURL(...arguments);
|
||||
|
||||
try {
|
||||
const parsedUrl = new URL(url);
|
||||
if (!parsedUrl.searchParams.get('formats')) {
|
||||
parsedUrl.searchParams.set('formats', 'mobiledoc,lexical');
|
||||
return parsedUrl.href;
|
||||
}
|
||||
} catch (e) {
|
||||
// noop, just use the original url
|
||||
console.error('Couldn\'t parse URL', e); // eslint-disable-line
|
||||
}
|
||||
|
||||
return options;
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
@ -24,11 +24,20 @@ export default class Post extends ApplicationAdapter {
|
||||
return parsedUrl.toString();
|
||||
}
|
||||
|
||||
buildQuery(store, modelName, options) {
|
||||
if (!options.formats) {
|
||||
options.formats = 'mobiledoc,lexical';
|
||||
buildURL() {
|
||||
const url = super.buildURL(...arguments);
|
||||
|
||||
try {
|
||||
const parsedUrl = new URL(url);
|
||||
if (!parsedUrl.searchParams.get('formats')) {
|
||||
parsedUrl.searchParams.set('formats', 'mobiledoc,lexical');
|
||||
return parsedUrl.href;
|
||||
}
|
||||
} catch (e) {
|
||||
// noop, just use the original url
|
||||
console.error('Couldn\'t parse URL', e); // eslint-disable-line
|
||||
}
|
||||
|
||||
return options;
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user