diff --git a/frontend/src/components/layout/NavBar.vue b/frontend/src/components/layout/NavBar.vue index 9e49d1b9..d0047d4a 100644 --- a/frontend/src/components/layout/NavBar.vue +++ b/frontend/src/components/layout/NavBar.vue @@ -1,13 +1,13 @@ @@ -37,21 +41,31 @@ const goTo = (path: string) => router.push(path) - + + + + + {{ item.label }} + + + logout()" > - - {{ item.label }} + + Logout @@ -77,6 +91,13 @@ const goTo = (path: string) => router.push(path) /> {{ item.label }} + logout()" + class="flex flex-col items-center justify-center gap-1 flex-1 h-full text-xs transition-colors text-muted-foreground" + > + + Logout + diff --git a/frontend/src/composable/useAuth.ts b/frontend/src/composable/useAuth.ts index c1645ee5..c606c437 100644 --- a/frontend/src/composable/useAuth.ts +++ b/frontend/src/composable/useAuth.ts @@ -1,6 +1,6 @@ import { ref } from 'vue' import { authApi, type LoginResponse, type RegisterCredentials } from '@/api/auth' -import { getSocket } from '@/plugins/socket' +import { disconnectSocket, getSocket } from '@/plugins/socket' import router from '@/router' import { useAuthStore } from '@/store/useAuthStore' @@ -99,12 +99,12 @@ export function useAuth() { useAuthStore().clearSession() - getSocket().close() + disconnectSocket() } - const disconnect = (): void => { + const disconnect = async (): Promise => { logout() - router.push({ name: 'home' }).then(r => {}) + await router.push({ name: 'auth' }) } const forgotPassword = async (email: string): Promise => {