feat(desktop): enhance error handling and logging for session synchronization and window mode transitions
This commit is contained in:
@@ -30,7 +30,14 @@ function getModeBridge(): WindowModeBridge | undefined {
|
||||
}
|
||||
|
||||
function syncWindowMode(authenticated: boolean): void {
|
||||
void getModeBridge()?.setWindowMode?.(authenticated ? 'main' : 'login', { source: 'auth-state' })
|
||||
void getModeBridge()
|
||||
?.setWindowMode?.(authenticated ? 'main' : 'login', { source: 'auth-state' })
|
||||
.catch((err) => {
|
||||
console.warn('[desktop-app] window mode sync failed', {
|
||||
authenticated,
|
||||
message: err instanceof Error ? err.message : String(err),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const rendererWindowMode = resolveRendererWindowMode()
|
||||
@@ -62,7 +69,11 @@ if (rendererWindowMode === 'main') {
|
||||
|
||||
onMounted(() => {
|
||||
if (rendererWindowMode !== 'login') {
|
||||
void syncRuntimeSession()
|
||||
void syncRuntimeSession().catch((err) => {
|
||||
console.warn('[desktop-app] runtime session sync failed', {
|
||||
message: err instanceof Error ? err.message : String(err),
|
||||
})
|
||||
})
|
||||
}
|
||||
if (usesAutomaticWindowMode) {
|
||||
syncWindowMode(isAuthenticated.value)
|
||||
|
||||
Reference in New Issue
Block a user