|
@@ -184,10 +184,9 @@
|
184
|
184
|
<a class="dropdown-item cursor-pointer" @click="routerGoTo('/Offers')">Offers</a>
|
185
|
185
|
</div>
|
186
|
186
|
</li>
|
187
|
|
- <li class="nav-item dropdown">
|
|
187
|
+ <li class="nav-item dropdown" v-if="hideLogin">
|
188
|
188
|
<a
|
189
|
189
|
class="nav-link"
|
190
|
|
- v-if="hideLogin"
|
191
|
190
|
@click="routerGoTo('/user/login')"
|
192
|
191
|
id="navbarDropdown"
|
193
|
192
|
role="button"
|
|
@@ -196,15 +195,19 @@
|
196
|
195
|
aria-expanded="false"
|
197
|
196
|
>Login</a>
|
198
|
197
|
</li>
|
199
|
|
- <li class="nav-item dropdown">
|
200
|
|
- <span v-if="showLogout">
|
|
198
|
+ <li class="nav-item dropdown" v-if="showLogout">
|
|
199
|
+ <span>
|
201
|
200
|
<a class="nav-link" @click="logout()">Logout</a>
|
202
|
201
|
</span>
|
203
|
|
- <span v-else></span>
|
|
202
|
+ <!-- <span v-else></span> -->
|
204
|
203
|
</li>
|
205
|
204
|
<li>
|
206
|
205
|
<span v-if="showLogout">
|
207
|
|
- <a>Welcome! <br/> {{ username }}</a>
|
|
206
|
+ <a>
|
|
207
|
+ Welcome!
|
|
208
|
+ <br />
|
|
209
|
+ {{ username }}
|
|
210
|
+ </a>
|
208
|
211
|
</span>
|
209
|
212
|
<span v-else></span>
|
210
|
213
|
</li>
|
|
@@ -227,33 +230,39 @@
|
227
|
230
|
</template>
|
228
|
231
|
|
229
|
232
|
<script>
|
230
|
|
-import { mapGetters, mapActions } from "vuex";
|
|
233
|
+import { mapGetters, mapActions } from 'vuex';
|
231
|
234
|
|
232
|
235
|
export default {
|
233
|
236
|
data() {
|
234
|
237
|
return {
|
235
|
|
- username: localStorage.getItem('name'),
|
|
238
|
+ username: sessionStorage.getItem('name'),
|
236
|
239
|
};
|
237
|
240
|
},
|
238
|
241
|
computed: {
|
239
|
242
|
showLogout() {
|
240
|
|
- return this.$store.state.authentication.status === "success";
|
|
243
|
+ // eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
|
244
|
+ this.username = sessionStorage.getItem('name');
|
|
245
|
+ return this.$store.state.authentication.status === 'success';
|
241
|
246
|
},
|
242
|
247
|
hideLogin() {
|
243
|
|
- return this.$store.state.authentication.status !== "success";
|
|
248
|
+ return this.$store.state.authentication.status !== 'success';
|
244
|
249
|
},
|
|
250
|
+ // eslint-disable-next-line vue/return-in-computed-property
|
245
|
251
|
Logout() {
|
246
|
|
- return this.$store.state.authentication.methods.logout;
|
247
|
|
- }
|
|
252
|
+ // eslint-disable-next-line no-unused-expressions
|
|
253
|
+ this.$store.state.authentication.methods.logout;
|
|
254
|
+ // eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
|
255
|
+ this.$router.push('/user/login');
|
|
256
|
+ },
|
248
|
257
|
},
|
249
|
258
|
|
250
|
259
|
methods: {
|
251
|
|
- ...mapGetters("authentication", ["isLoggedIn"]),
|
252
|
|
- ...mapActions("authentication", ["logout"]),
|
|
260
|
+ ...mapGetters('authentication', ['isLoggedIn']),
|
|
261
|
+ ...mapActions('authentication', ['logout']),
|
253
|
262
|
|
254
|
263
|
routerGoTo(goTo) {
|
255
|
|
- this.$emit("routerGoTo", goTo);
|
256
|
|
- }
|
257
|
|
- }
|
|
264
|
+ this.$emit('routerGoTo', goTo);
|
|
265
|
+ },
|
|
266
|
+ },
|
258
|
267
|
};
|
259
|
268
|
</script>
|