audiobookshelf/client/middleware/authenticated.js
2021-09-24 07:32:38 -05:00

7 lines
250 B
JavaScript

export default function ({ store, redirect, route, app }) {
// If the user is not authenticated
if (!store.state.user.user) {
if (route.name === 'batch') return redirect('/login')
return redirect(`/login?redirect=${route.fullPath}`)
}
}