Replaced i18n w/ tpl in /core/server/api/v3/session.js (#13525)

refs: #13380

- The i18n package is deprecated. It is being replaced with the tpl package.
This commit is contained in:
Ayoub BERDEDDOUCH 2021-10-11 15:39:19 +02:00 committed by GitHub
parent 887caa299f
commit 8961785dfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,10 +1,14 @@
const Promise = require('bluebird');
const i18n = require('../../../shared/i18n');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const models = require('../../models');
const auth = require('../../services/auth');
const api = require('./index');
const messages = {
accessDenied: 'Access denied.'
};
const session = {
read(frame) {
/*
@ -20,7 +24,7 @@ const session = {
if (!object || !object.username || !object.password) {
return Promise.reject(new errors.UnauthorizedError({
message: i18n.t('errors.middleware.auth.accessDenied')
message: tpl(messages.accessDenied)
}));
}
@ -40,7 +44,7 @@ const session = {
}).catch(async (err) => {
if (!errors.utils.isIgnitionError(err)) {
throw new errors.UnauthorizedError({
message: i18n.t('errors.middleware.auth.accessDenied'),
message: tpl(messages.accessDenied),
err
});
}