瀏覽代碼

:sparkles: Implemented logout

brian_dev_incorp_login
tomit4 2 年之前
父節點
當前提交
23b935ca8f

+ 4
- 3
frontend/src/components/MainNav.vue 查看文件

19
         w-button.pa8(disabled)
19
         w-button.pa8(disabled)
20
             w-icon.mr1.icon-cog(xl :class="{ 'icon-selected': $route.path === '/settings' }")
20
             w-icon.mr1.icon-cog(xl :class="{ 'icon-selected': $route.path === '/settings' }")
21
             //- p.text-upper settings
21
             //- p.text-upper settings
22
+    w-button.pa4(v-if="!$route.params.pid" bg-color='transparent' @click="$emit('log-out')")
23
+            w-icon.mr1.icon-lock(xl)
22
 </template>
24
 </template>
23
 
25
 
24
 <script>
26
 <script>
40
 
42
 
41
     .w-button
43
     .w-button
42
         background-color: $dark-grey
44
         background-color: $dark-grey
43
-    
45
+
44
     .icon-selected
46
     .icon-selected
45
         color: $light-green
47
         color: $light-green
46
-    
48
+
47
     a
49
     a
48
         color:$light-grey
50
         color:$light-grey
49
 </style>
51
 </style>
50
-

+ 9
- 0
frontend/src/services/login.service.js 查看文件

114
     }
114
     }
115
     logout() {
115
     logout() {
116
         console.warn('[Login Service warn]: Logging out:', this.id.value)
116
         console.warn('[Login Service warn]: Logging out:', this.id.value)
117
+        this._loading.value = true
118
+        this._profile = null
117
         this.id.value = null
119
         this.id.value = null
120
+        this.groupings = []
121
+        this.queue = []
122
+        this.responses = []
123
+        this.tags = []
118
         if (this.toaster) {
124
         if (this.toaster) {
119
             this.toaster.stop()
125
             this.toaster.stop()
120
         }
126
         }
121
         if (this.chatter) {
127
         if (this.chatter) {
122
             this.chatter.stop()
128
             this.chatter.stop()
123
         }
129
         }
130
+        this.toaster = null
131
+        this.chatter = null
132
+        this._loading.value = false
124
     }
133
     }
125
 
134
 
126
     async getTags() {
135
     async getTags() {

+ 8
- 1
frontend/src/views/HomeView.vue 查看文件

10
 
10
 
11
         template(v-else-if='cards.length === 0')
11
         template(v-else-if='cards.length === 0')
12
             p No profiles in match_queue.
12
             p No profiles in match_queue.
13
-    MainNav
13
+    MainNav(@log-out='logout')
14
 </template>
14
 </template>
15
 
15
 
16
 <script>
16
 <script>
91
             )
91
             )
92
             this.fetchedCards.push(...newQueue) // update fetchedCards => recalculate cards
92
             this.fetchedCards.push(...newQueue) // update fetchedCards => recalculate cards
93
         },
93
         },
94
+        async logout() {
95
+            if (currentProfile.isLoggedIn) {
96
+                currentProfile.logout()
97
+            }
98
+            document.cookie = `siimee_access=''; max-age=600; path=/; secure`
99
+            this.$router.push('/onboarding')
100
+        },
94
         // this can be placed in utils/notification.js
101
         // this can be placed in utils/notification.js
95
         notify(payload) {
102
         notify(payload) {
96
             notificationOpts.message = payload
103
             notificationOpts.message = payload

+ 0
- 3
frontend/src/views/OnboardingView.vue 查看文件

55
         invalidResponse: false,
55
         invalidResponse: false,
56
     }),
56
     }),
57
     async created() {
57
     async created() {
58
-        // TODO: Troubleshoot bug where memberships are not returned from backend with 500 err
59
-        // TODO: Troubleshoot bug where not all responses are returned at SurveyCompleteView
60
-        console.log('currentProfile :=>', currentProfile)
61
         this.survey = await surveyFactory.createSurvey()
58
         this.survey = await surveyFactory.createSurvey()
62
         hashedAccessToken = this.grabStoredCookie('siimee_access')
59
         hashedAccessToken = this.grabStoredCookie('siimee_access')
63
         try {
60
         try {

Loading…
取消
儲存