diff --git a/apps/web/src/components/navbar/navbar.tsx b/apps/web/src/components/navbar/navbar.tsx index 0042a5619bdb6e0cb1e8ae6db3452e6c6de94a7c..76534f6016626d78ef7c77199b9347da8296b0c8 100644 --- a/apps/web/src/components/navbar/navbar.tsx +++ b/apps/web/src/components/navbar/navbar.tsx @@ -214,7 +214,7 @@ export const Navbar = (props: NavbarComponentProps) => { {auth.authorized ? ( <> <div className="menu-title"> - <h2>user: {auth.userID}</h2> + <h2>user: {auth.username}</h2> <h3 className="text-xs">session: {auth.sessionID}</h3> </div> <li> @@ -285,7 +285,7 @@ export const Navbar = (props: NavbarComponentProps) => { ) : ( <> <div className="menu-title"> - <h2>user: {auth.userID}</h2> + <h2>user: {auth.username}</h2> <h3 className="text-xs">session: {auth.sessionID}</h3> </div> <div> diff --git a/libs/shared/lib/data-access/authorization/useAuth.tsx b/libs/shared/lib/data-access/authorization/useAuth.tsx index c4c64b8f5fe4be048ba5e8e26a0d818ce1cda3f0..a2a1854217187da82899e69f26433faaceb94088 100644 --- a/libs/shared/lib/data-access/authorization/useAuth.tsx +++ b/libs/shared/lib/data-access/authorization/useAuth.tsx @@ -5,10 +5,8 @@ import { useAppDispatch, useAuthorizationCache } from '../store'; import { authorized } from '../store/authSlice'; export type AuthenticationHeader = { - sessionData: { - userID: string; - sessionID: string; - }; + username: string; + sessionID: string; jwt: string; }; @@ -30,7 +28,7 @@ export const useAuth = () => { console.warn('skipping login'); dispatch( authorized({ - userID: 'UserID', + username: 'UserID', sessionID: 'SessionID', jwt: 'jwt', authorized: true, @@ -50,8 +48,8 @@ export const useAuth = () => { .then((res: AuthenticationHeader) => { dispatch( authorized({ - userID: res.sessionData.userID, - sessionID: res.sessionData.sessionID, + username: res.username, + sessionID: res.sessionID, jwt: res.jwt, authorized: true, }) @@ -70,7 +68,6 @@ export const useAuth = () => { init.method = init.method || 'GET'; init.headers = { 'Content-Type': 'application/json', - // Userid: auth.userID || '', sessionid: auth.sessionID || '', // Authorization: `Bearer ${auth.jwt}`, ...init.headers, diff --git a/libs/shared/lib/data-access/socket/backend-message-receiver/WebSocketHandler.tsx b/libs/shared/lib/data-access/socket/backend-message-receiver/WebSocketHandler.tsx index 203e56bbb2ca0994378bb46b26acd662a6049882..d457018c01fef178bd1a910674862746ae3df0c4 100644 --- a/libs/shared/lib/data-access/socket/backend-message-receiver/WebSocketHandler.tsx +++ b/libs/shared/lib/data-access/socket/backend-message-receiver/WebSocketHandler.tsx @@ -37,7 +37,6 @@ export class WebSocketHandler implements BackendMessageReceiver { const params = new URLSearchParams(); if (this.authHeader?.sessionID) params.set('sessionID', this.authHeader?.sessionID ?? ''); - if (this.authHeader?.userID) params.set('userID', this.authHeader?.userID ?? ''); if (this.authHeader?.jwt) params.set('jwt', this.authHeader?.jwt ?? ''); this.webSocket = new WebSocket(this.url + '?' + params.toString()); this.webSocket.onopen = () => onOpen(); diff --git a/libs/shared/lib/data-access/store/authSlice.ts b/libs/shared/lib/data-access/store/authSlice.ts index 663ce51a80b83dff46e2bd14e9d1eda64578a8d5..13b1bfbad255f28295e9bdb2a19f95aef9eb980b 100644 --- a/libs/shared/lib/data-access/store/authSlice.ts +++ b/libs/shared/lib/data-access/store/authSlice.ts @@ -5,7 +5,7 @@ export type UseIsAuthorizedState = { authorized: boolean | undefined; jwt: string | undefined; sessionID: string | undefined; - userID: string | undefined; + username: string | undefined; }; // Define the initial state using that type @@ -13,7 +13,7 @@ export const initialState: UseIsAuthorizedState = { authorized: undefined, jwt: undefined, sessionID: undefined, - userID: undefined, + username: undefined, }; export const authSlice = createSlice({ @@ -26,14 +26,14 @@ export const authSlice = createSlice({ state.authorized = action.payload.authorized; state.jwt = action.payload.jwt; state.sessionID = action.payload.sessionID; - state.userID = action.payload.userID; + state.username = action.payload.username; }, logout(state) { console.info('Logging out'); state.authorized = undefined; state.jwt = undefined; state.sessionID = undefined; - state.userID = undefined; + state.username = undefined; }, unauthorized(state) { console.warn('Unauthorized');