Skip to content
Merged
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
8 changes: 6 additions & 2 deletions packages/server-admin-ui-react19/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ export async function logoutAction(): Promise<void> {
if (!response.ok) {
throw new Error(response.statusText)
}
await fetchLoginStatus()
} catch (error) {
console.error('Logout failed:', error)
await fetchLoginStatus()
}
// Reconnect WebSocket so admin event subscriptions are dropped
webSocketService.reconnect()
await fetchLoginStatus()
}

export function restartAction(): void {
Expand Down Expand Up @@ -63,6 +64,9 @@ export async function loginAction(
if (request.status !== 200) {
return response.message
}
// Reconnect WebSocket so the server subscribes the new authenticated
// connection to admin events (ACCESS_REQUEST, etc.)
webSocketService.reconnect()
await fetchAllData()
return null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ export class WebSocketService {
case 'ACCESS_REQUEST':
this.zustandSetState({ accessRequests: data } as Partial<SignalKStore>)
break
case 'RECEIVE_LOGIN_STATUS':
this.zustandSetState({ loginStatus: data } as Partial<SignalKStore>)
break
case 'DISCOVERY_CHANGED':
this.zustandSetState({
discoveredProviders: data
Expand Down
Loading