Kaynağa Gözat

:construction: Small optimization for authenticator, note in guards.js

brian_dev_survey_complete
tomit4 2 yıl önce
ebeveyn
işleme
68c09decd4

+ 1
- 0
frontend/src/router/guards.js Dosyayı Görüntüle

@@ -13,6 +13,7 @@ async function log(to) {
13 13
     }
14 14
 }
15 15
 
16
+// TODO: move to utils/index.js and import to this file, OnboardingView.vue and VerifyView.vue
16 17
 const grabStoredCookie = cookieKey => {
17 18
     const cookies = document.cookie.split('; ').reduce((prev, current) => {
18 19
         const [name, ...value] = current.split('=')

+ 3
- 5
frontend/src/views/OnboardingView.vue Dosyayı Görüntüle

@@ -30,11 +30,11 @@ main.view--onboarding
30 30
             p(v-if='currentStep != 0') You have completed: {{ currentStep }} / {{ survey?.steps?.length }} survey steps
31 31
 
32 32
     article(v-else)
33
-        SurveyCompleteView(:answers='answered' :surveySteps='survey?.steps')
33
+        SurveyCompleteView(:answers='answered' :surveySteps='survey.steps' :responses='responses')
34 34
 </template>
35 35
 
36 36
 <script>
37
-import { currentProfile, Authenticator } from '../services'
37
+import { currentProfile, authenticator } from '../services'
38 38
 import { surveyFactory } from '@/utils'
39 39
 import stepViews from '@/components/onboarding'
40 40
 import SurveyCompleteView from './SurveyCompleteView.vue'
@@ -53,11 +53,9 @@ export default {
53 53
         currentStep: 0,
54 54
         survey: null,
55 55
         invalidResponse: false,
56
-        authenticator: {},
57 56
     }),
58 57
     async created() {
59 58
         this.survey = await surveyFactory.createSurvey()
60
-        this.authenticator = new Authenticator()
61 59
         hashedAccessToken = this.grabStoredCookie('siimee_access')
62 60
         console.log('currentProfile.isLoggedIn :=>', currentProfile.isLoggedIn)
63 61
         try {
@@ -99,7 +97,7 @@ export default {
99 97
         async verifySession(hashedAccessToken) {
100 98
             if (!hashedAccessToken)
101 99
                 return console.warn('WARNING :=> accessToken is not defined')
102
-            const validatedToken = await this.authenticator.validateSession(
100
+            const validatedToken = await authenticator.validateSession(
103 101
                 hashedAccessToken,
104 102
             )
105 103
             if (validatedToken.error) {

Loading…
İptal
Kaydet