Selaa lähdekoodia

:sparkles: Implemented logout

tags/0.0.4
tomit4 2 vuotta sitten
vanhempi
commit
a143d45e2c

+ 4
- 3
frontend/src/components/MainNav.vue Näytä tiedosto

@@ -19,6 +19,8 @@ w-toolbar.mt6.py1(bottom fixed)
19 19
         w-button.pa8(disabled)
20 20
             w-icon.mr1.icon-cog(xl :class="{ 'icon-selected': $route.path === '/settings' }")
21 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 24
 </template>
23 25
 
24 26
 <script>
@@ -40,11 +42,10 @@ export default {
40 42
 
41 43
     .w-button
42 44
         background-color: $dark-grey
43
-    
45
+
44 46
     .icon-selected
45 47
         color: $light-green
46
-    
48
+
47 49
     a
48 50
         color:$light-grey
49 51
 </style>
50
-

+ 9
- 0
frontend/src/services/login.service.js Näytä tiedosto

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

+ 8
- 1
frontend/src/views/HomeView.vue Näytä tiedosto

@@ -10,7 +10,7 @@ main.view--home
10 10
 
11 11
         template(v-else-if='cards.length === 0')
12 12
             p No profiles in match_queue.
13
-    MainNav
13
+    MainNav(@log-out='logout')
14 14
 </template>
15 15
 
16 16
 <script>
@@ -91,6 +91,13 @@ export default {
91 91
             )
92 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 101
         // this can be placed in utils/notification.js
95 102
         notify(payload) {
96 103
             notificationOpts.message = payload

Loading…
Peruuta
Tallenna