Replace i18n with tpl in api/v3/pages.js (#13585)

refs: #13380

- The i18n package is deprecated. It is being replaced with the tpl package.
This commit is contained in:
PJ 2021-10-13 19:06:53 +11:00 committed by GitHub
parent 6e14047a2a
commit f8033596c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,12 @@
const models = require('../../models');
const i18n = require('../../../shared/i18n');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const getPostServiceInstance = require('../../services/posts/posts-service');
const ALLOWED_INCLUDES = ['tags', 'authors', 'authors.roles'];
const UNSAFE_ATTRS = ['status', 'authors', 'visibility'];
const messages = {
pageNotFound: 'Page not found'
};
const postsService = getPostServiceInstance('v3');
@ -75,7 +78,7 @@ module.exports = {
.then((model) => {
if (!model) {
throw new errors.NotFoundError({
message: i18n.t('errors.api.pages.pageNotFound')
message: tpl(messages.pageNotFound)
});
}
@ -188,7 +191,7 @@ module.exports = {
.then(() => null)
.catch(models.Post.NotFoundError, () => {
return Promise.reject(new errors.NotFoundError({
message: i18n.t('errors.api.pages.pageNotFound')
message: tpl(messages.pageNotFound)
}));
});
}