Skip to content

Commit

Permalink
fix(frontend): fix logout
Browse files Browse the repository at this point in the history
  • Loading branch information
Mala1180 committed Aug 27, 2024
1 parent b044f75 commit f23731b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/NavbarComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { symSharpControlCamera } from '@quasar/extras/material-symbols-sharp'
import router from '@/router'
import { computed, ref } from 'vue'
import RequestHelper, { authHost } from '@/utils/RequestHelper'
import { HttpStatusCode as AxiosHttpStatusCode } from 'axios'
import HttpStatusCode from '@common/utils/HttpStatusCode.js'
import { useUserStore } from '@/stores/user'
import { closeSocketServers } from '@/socket'
import { UserRole } from '@/domain/core/UserRole'
Expand All @@ -17,7 +17,7 @@ const logout = () => {
RequestHelper.post(`${authHost}/logout`, {
username: userStore.username
}).then((res: any): void => {
if (res.status == AxiosHttpStatusCode.Ok) {
if (res.status == HttpStatusCode.OK) {
useUserStore().clearFields()
closeSocketServers()
router.push('/login')
Expand Down
1 change: 1 addition & 0 deletions frontend/src/stores/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const useUserStore = defineStore(
const refreshToken = ref<string>('')

function clearFields() {
isLoggedIn.value = false
id.value = ''
name.value = ''
surname.value = ''
Expand Down

0 comments on commit f23731b

Please sign in to comment.