Merge pull request #82 from chamikaJ/fix/socket-event-not-updating
Refactor socket session user structure and update user ID retrieval
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
export interface ISocketSession {
|
export interface ISocketSession {
|
||||||
session?: {
|
session?: {
|
||||||
passport?: { user?: string; }
|
passport?: { user?: { id: string } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ export function log_error(error: any) {
|
|||||||
|
|
||||||
export function getLoggedInUserIdFromSocket(socket: Socket): string | null {
|
export function getLoggedInUserIdFromSocket(socket: Socket): string | null {
|
||||||
const {session} = socket.request as ISocketSession;
|
const {session} = socket.request as ISocketSession;
|
||||||
return session?.passport?.user || null;
|
if (session?.passport?.user?.id) {
|
||||||
|
return session.passport.user.id;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function notifyProjectUpdates(socket: Socket, taskId: string) {
|
export async function notifyProjectUpdates(socket: Socket, taskId: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user