| 12345678910111213141516171819202122232425 |
- import { currentProfile } from '../services'
-
-
- const checkLoginStatus = (destination, nextCb) => {
- if(!currentProfile.isLoggedIn || !currentProfile.isComplete) {
- console.warn(`profile: ${currentProfile.id.value} | login: ${currentProfile.isLoggedIn} | completed: ${currentProfile.isComplete}`)
- }
- if (
- destination.meta.requiresCompleteProfile &&
- !currentProfile.isLoggedIn &&
- !currentProfile.isComplete
- ) {
- nextCb('survey')
- } else if(
- destination.meta.requiresCompleteProfile &&
- destination.meta.requiresAuth &&
- !currentProfile.isLoggedIn
- ) {
- nextCb('login')
- } else {
- nextCb()
- }
- }
-
- export { checkLoginStatus }
|