mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 14:03:48 +03:00
Replaced i18n.t w/ tpl in version-match middleware
refs: TryGhost#13380 - The i18n package is deprecated. It is being replaced with the tpl package.
This commit is contained in:
parent
b1395bbe20
commit
d1b7055af5
@ -1,6 +1,10 @@
|
||||
const semver = require('semver');
|
||||
const errors = require('@tryghost/errors');
|
||||
const i18n = require('../../../../shared/i18n');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
|
||||
const messages = {
|
||||
versionMismatch: 'Client request for {clientVersion} does not match server version {serverVersion}.'
|
||||
};
|
||||
|
||||
function checkVersionMatch(req, res, next) {
|
||||
const clientVersion = req.get('X-Ghost-Version');
|
||||
@ -14,7 +18,7 @@ function checkVersionMatch(req, res, next) {
|
||||
|
||||
if (clientVersion && !semver.satisfies(serverVersion, constraint)) {
|
||||
return next(new errors.VersionMismatchError({
|
||||
message: i18n.t('errors.middleware.api.versionMismatch', {
|
||||
message: tpl(messages.versionMismatch, {
|
||||
clientVersion: clientVersion,
|
||||
serverVersion: serverVersion
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user