mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-05 09:50:34 +03:00
Removed API versioning from webhooks
refs: https://github.com/TryGhost/Toolbox/issues/229 refs: https://github.com/TryGhost/Toolbox/issues/283 - we are getting rid of the concept of having multiple api versions in a single ghost install - we'll update webhooks to return a content version - we're also looking into if we need some sort of accept-version type logic
This commit is contained in:
parent
923d436f11
commit
1fbb8a219f
@ -1,9 +1,7 @@
|
|||||||
module.exports = (event, model) => {
|
module.exports = (event, model) => {
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const {sequence} = require('@tryghost/promise');
|
const {sequence} = require('@tryghost/promise');
|
||||||
const api = require('../../api');
|
const api = require('../../api').canary;
|
||||||
|
|
||||||
const apiVersion = model.get('api_version') || 'v4';
|
|
||||||
|
|
||||||
const resourceName = event.match(/(\w+)\./)[1];
|
const resourceName = event.match(/(\w+)\./)[1];
|
||||||
const docName = `${resourceName}s`;
|
const docName = `${resourceName}s`;
|
||||||
@ -22,7 +20,7 @@ module.exports = (event, model) => {
|
|||||||
return api.shared
|
return api.shared
|
||||||
.serializers
|
.serializers
|
||||||
.handle
|
.handle
|
||||||
.output(model, {docName: docName, method: 'read'}, api[apiVersion].serializers.output, frame)
|
.output(model, {docName: docName, method: 'read'}, api.serializers.output, frame)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return frame.response[docName][0];
|
return frame.response[docName][0];
|
||||||
});
|
});
|
||||||
@ -45,7 +43,7 @@ module.exports = (event, model) => {
|
|||||||
return api.shared
|
return api.shared
|
||||||
.serializers
|
.serializers
|
||||||
.handle
|
.handle
|
||||||
.output(model, {docName: docName, method: 'read'}, api[apiVersion].serializers.output, frame)
|
.output(model, {docName: docName, method: 'read'}, api.serializers.output, frame)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return frame.response[docName][0];
|
return frame.response[docName][0];
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user