Ghost/ghost/admin/app/routes/websockets.js
Peter Zimon e68db848dc
AdminX: reroute settings-x to settings (#18360)
refs. https://github.com/TryGhost/Product/issues/3949

---------

Co-authored-by: Jono Mingard <reason.koan@gmail.com>
Co-authored-by: Daniel Lockyer <hi@daniellockyer.com>
2023-10-09 08:12:46 +01:00

19 lines
485 B
JavaScript

import AuthenticatedRoute from './authenticated';
import {inject as service} from '@ember/service';
// need this to be authenticated
export default class WebsocketRoute extends AuthenticatedRoute {
@service session;
@service router;
beforeModel() {
super.beforeModel(...arguments);
const user = this.session.user;
if (!user.isAdmin) {
return this.router.transitionTo('settings-x.settings-x', `staff/${user.slug}`);
}
}
}