diff --git a/app/src/common/EventBus.ts b/app/src/common/EventBus.ts index c0d5f9a..ff070f2 100644 --- a/app/src/common/EventBus.ts +++ b/app/src/common/EventBus.ts @@ -1,11 +1,11 @@ const eventBus = { - on(event: string, callback) { + on(event: string, callback: EventListenerOrEventListenerObject) { document.addEventListener(event, (e) => callback(e.detail)); }, - dispatch(event: string, data) { + dispatch(event: string, data: any) { document.dispatchEvent(new CustomEvent(event, { detail: data })); }, - remove(event: string, callback) { + remove(event: string, callback: EventListenerOrEventListenerObject) { document.removeEventListener(event, callback); }, }; diff --git a/app/src/store/auth.ts b/app/src/store/auth.ts index 53c335d..e469f86 100644 --- a/app/src/store/auth.ts +++ b/app/src/store/auth.ts @@ -3,6 +3,7 @@ import Pitcher from "@/types/Pitcher"; import { Module, ActionContext } from 'vuex'; import { RootState } from './index'; +import TokenService from "@/services/TokenService"; export interface AuthState { isAuthenticated: boolean; @@ -63,6 +64,7 @@ const auth: Module = { logout(state) { state.isAuthenticated = false; state.user = null; + TokenService.removeUser(); }, registerSuccess(state) { state.isAuthenticated = false; diff --git a/app/src/views/Home.vue b/app/src/views/Home.vue index 1fdb160..113c3de 100644 --- a/app/src/views/Home.vue +++ b/app/src/views/Home.vue @@ -1,11 +1,14 @@ +
{{ firstName }} {{ lastName }}
@@ -58,6 +68,10 @@ const showProfile = () => { Show Profile + + + Logout +
diff --git a/app/src/views/PreparePitch.vue b/app/src/views/PreparePitch.vue index fbe7e43..b0dd72b 100644 --- a/app/src/views/PreparePitch.vue +++ b/app/src/views/PreparePitch.vue @@ -1,6 +1,6 @@