瀏覽代碼

:construction: Differentiated data from component variables

tags/0.0.3^2
tomit4 3 年之前
父節點
當前提交
41ae7747d6
共有 2 個檔案被更改,包括 11 行新增12 行删除
  1. 2
    2
      frontend/src/components/onboarding/Auth.vue
  2. 9
    10
      frontend/src/views/VerifyView.vue

+ 2
- 2
frontend/src/components/onboarding/Auth.vue 查看文件

@@ -54,8 +54,8 @@ export default {
54 54
             document.cookie = `siimee_session=${sessionToken}; max-age=600; path=/; secure`
55 55
             await this.authenticator.sendAuthEmail(this.answered)
56 56
         } catch (err) {
57
-            // TODO: redirect to an error page displaying which
58
-            // error occurred and how to reach out to staff??
57
+            // TODO: render an error page in this component displaying which
58
+            // error occurred and how to reach out to staff
59 59
             console.error('ERROR :=>', err)
60 60
         }
61 61
     },

+ 9
- 10
frontend/src/views/VerifyView.vue 查看文件

@@ -6,23 +6,22 @@
6 6
 
7 7
 <script>
8 8
 import { Authenticator } from '../services/auth.service.js'
9
+let hash = null
10
+let sessionToken = null
9 11
 export default {
10 12
     name: 'VerifyView',
11 13
     data: () => ({
12 14
         authenticator: {},
13
-        answers: {},
14
-        hash: undefined,
15
-        sessionToken: undefined,
16 15
     }),
17 16
     async created() {
18 17
         this.authenticator = new Authenticator()
19
-        this.hash = this.$route.params.email
20
-        this.sessionToken = this.grabCookie('siimee_session')
18
+        hash = this.$route.params.email
19
+        sessionToken = this.grabCookie('siimee_session')
21 20
         try {
22
-            this.isHashInUrl(this.hash)
23
-            this.doesEmailMatch(this.hash)
24
-            this.doesSessionTokenExist(this.sessionToken)
25
-            this.isSessionTokenValid(this.sessionToken)
21
+            this.isHashInUrl(hash)
22
+            this.doesEmailMatch(hash)
23
+            this.doesSessionTokenExist(sessionToken)
24
+            this.isSessionTokenValid(sessionToken)
26 25
         } catch (err) {
27 26
             console.error(err)
28 27
         }
@@ -68,7 +67,7 @@ export default {
68 67
                 throw new Error(sessionTokenIsValid.error)
69 68
             } else {
70 69
                 // TODO: Does accessToken need sessionToken data?
71
-                await this.getAccessToken(...this.sessionToken)
70
+                await this.getAccessToken(...sessionToken)
72 71
             }
73 72
         },
74 73
     },

Loading…
取消
儲存