|
|
@@ -1,5 +1,6 @@
|
|
1
|
|
-import { currentProfile, authenticator } from '../services'
|
|
2
|
1
|
import WaveUI from '../../node_modules/wave-ui/src/wave-ui/core'
|
|
|
2
|
+import { authenticator, currentProfile } from '../services'
|
|
|
3
|
+
|
|
3
|
4
|
const DEV_MODE = import.meta.env.VITE_DEV == 'true'
|
|
4
|
5
|
|
|
5
|
6
|
async function log(to) {
|
|
|
@@ -13,7 +14,6 @@ async function log(to) {
|
|
13
|
14
|
}
|
|
14
|
15
|
}
|
|
15
|
16
|
|
|
16
|
|
-// TODO: move to utils/index.js and import to this file, OnboardingView.vue and VerifyView.vue
|
|
17
|
17
|
const grabStoredCookie = cookieKey => {
|
|
18
|
18
|
const cookies = document.cookie.split('; ').reduce((prev, current) => {
|
|
19
|
19
|
const [name, ...value] = current.split('=')
|
|
|
@@ -28,9 +28,8 @@ const verifySession = async () => {
|
|
28
|
28
|
const hashedAccessToken = grabStoredCookie('siimee_access')
|
|
29
|
29
|
if (!hashedAccessToken)
|
|
30
|
30
|
return console.warn('WARNING :=> accessToken is not defined')
|
|
31
|
|
- const validatedToken = await authenticator.validateSession(
|
|
32
|
|
- hashedAccessToken,
|
|
33
|
|
- )
|
|
|
31
|
+ const validatedToken =
|
|
|
32
|
+ await authenticator.validateSession(hashedAccessToken)
|
|
34
|
33
|
if (validatedToken.error) {
|
|
35
|
34
|
console.error('ERROR :=>', validatedToken.error)
|
|
36
|
35
|
} else {
|
|
|
@@ -47,7 +46,6 @@ const loginIfToken = async () => {
|
|
47
|
46
|
) {
|
|
48
|
47
|
await currentProfile.login(
|
|
49
|
48
|
sessionData.profileId,
|
|
50
|
|
- // NOTE: probably not correct...
|
|
51
|
49
|
WaveUI.notify,
|
|
52
|
50
|
sessionData.accessToken,
|
|
53
|
51
|
)
|