Skip to content

Commit

Permalink
logout mechanism fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio committed Dec 18, 2020
1 parent 2e169b8 commit 897af3f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 32 deletions.
12 changes: 8 additions & 4 deletions client/src/components/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

<script>
import AuthService from '@/services/AuthService';
import router from '../router';
export default {
data() {
return {
Expand All @@ -27,7 +29,7 @@ export default {
{
label: 'Logout',
icon: 'pi pi-fw pi-power-off',
command: () => this.logOut()
command: () => this.logout()
}
]
};
Expand All @@ -36,10 +38,12 @@ export default {
this.user = AuthService.currentUser;
},
methods: {
logOut() {
AuthService.logOut()
logout() {
AuthService.logout()
.then(() => {
this.$router.push({ name: 'Login' });
setTimeout(() => {
router.push('/login');
}, 0);
})
.catch(err => {
console.log(err);
Expand Down
1 change: 1 addition & 0 deletions client/src/services/AuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class AuthService {
return Auth.signOut();
}
clearData() {
this.currentUser = null;
window.localStorage.removeItem('user');
}
}
Expand Down
27 changes: 0 additions & 27 deletions client/src/views/Home.vue

This file was deleted.

1 change: 0 additions & 1 deletion client/src/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<Button label="Login" @click="login()" />
</div>
</template>
<!-- <section id="firebaseui-auth-container"></section> -->
</Card>
</template>

Expand Down

0 comments on commit 897af3f

Please sign in to comment.