Преглед изворни кода

:sparkles: Implemented logout

tags/0.0.4
tomit4 пре 2 година
родитељ
комит
a143d45e2c

+ 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

Loading…
Откажи
Сачувај