Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/app/MessageContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export const MessageProvider = ({
socket.disconnect().connect()
}
}
addTokenRefreshListener(handleTokenRefresh)
return addTokenRefreshListener(handleTokenRefresh)
}, [socket])

const applyOnlineStatus = useCallback(
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/app/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ const listeners: RefreshListener[] = []

export function addTokenRefreshListener(cb: RefreshListener) {
listeners.push(cb)
return () => {
const index = listeners.indexOf(cb)
if (index !== -1) {
listeners.splice(index, 1)
}
}
}

export function setToken(newToken: string | null) {
Expand Down
Loading