mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
21 lines
559 B
JavaScript
21 lines
559 B
JavaScript
import isEmpty from 'lodash/isEmpty'
|
|
|
|
export default async ({ store, env, route, redirect }) => {
|
|
const publicPages = env.publicPages
|
|
// only affect non public pages
|
|
if (publicPages.indexOf(route.name) >= 0) {
|
|
return true
|
|
}
|
|
|
|
if (route.name === 'terms-and-conditions-confirm') return true // avoid endless loop
|
|
|
|
if (store.getters['auth/termsAndConditionsAgreed']) return true
|
|
|
|
const params = {}
|
|
if (!isEmpty(route.path) && route.path !== '/') {
|
|
params.path = route.path
|
|
}
|
|
|
|
return redirect('/terms-and-conditions-confirm', params)
|
|
}
|