audiobookshelf/client/middleware/authenticated.js
2021-08-26 18:32:05 -05:00

7 lines
241 B
JavaScript

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