boussole-pluss/frontend/ middleware /redirect.ts

15 lines
452 B
TypeScript

import { Context } from '@nuxt/types'
export default function (context: Context) {
context.redirect(301, '/redirect');
}
// export default function ({ $auth, redirect }) {
// if (process.client) {
// if (!$auth.loggedIn || !$auth.user.role.includes('admin')) {
// redirect('/admin/login')
// }
// }
// }
// https://stackoverflow.com/questions/64433369/how-to-auto-redirect-to-login-after-an-unauthorized-api-request-ex-when-token