|
|
@@ -18,7 +18,8 @@ const loginIfToken = async () => {
|
|
18
|
18
|
const sessionData = await authenticator.checkSessionValid()
|
|
19
|
19
|
if (
|
|
20
|
20
|
sessionData?.profileId &&
|
|
21
|
|
- sessionData?.sessionToken
|
|
|
21
|
+ sessionData?.sessionToken &&
|
|
|
22
|
+ !currentProfile.isLoggedIn
|
|
22
|
23
|
) {
|
|
23
|
24
|
await currentProfile.login(
|
|
24
|
25
|
sessionData.profileId,
|
|
|
@@ -29,21 +30,22 @@ const loginIfToken = async () => {
|
|
29
|
30
|
}
|
|
30
|
31
|
|
|
31
|
32
|
const checkLoginStatus = async (destination, nextCb) => {
|
|
32
|
|
- if(!currentProfile.isLoggedIn) {
|
|
33
|
|
- await loginIfToken()
|
|
34
|
|
- }
|
|
|
33
|
+ await loginIfToken()
|
|
35
|
34
|
log(destination)
|
|
36
|
35
|
if (DEV_MODE) {
|
|
37
|
36
|
nextCb()
|
|
38
|
37
|
} else if (
|
|
39
|
|
- !currentProfile.isLoggedIn
|
|
|
38
|
+ destination.meta.requiresCompleteProfile &&
|
|
|
39
|
+ !currentProfile.isLoggedIn &&
|
|
|
40
|
+ !currentProfile.isComplete
|
|
40
|
41
|
) {
|
|
41
|
|
- nextCb('/login')
|
|
|
42
|
+ nextCb('/onboarding')
|
|
42
|
43
|
} else if (
|
|
43
|
44
|
destination.meta.requiresCompleteProfile &&
|
|
44
|
|
- destination.meta.requiresAuth
|
|
|
45
|
+ destination.meta.requiresAuth &&
|
|
|
46
|
+ !currentProfile.isLoggedIn
|
|
45
|
47
|
) {
|
|
46
|
|
- nextCb('/onboarding')
|
|
|
48
|
+ nextCb('/login')
|
|
47
|
49
|
} else {
|
|
48
|
50
|
nextCb()
|
|
49
|
51
|
}
|