fix: use correct preload API methods (listUsers, loginUser, getActiveUser)
Some checks failed
Release Binaries / release (push) Has been cancelled
Some checks failed
Release Binaries / release (push) Has been cancelled
This commit is contained in:
@@ -104,14 +104,11 @@ export async function initializeUserContext(): Promise<void> {
|
||||
console.log(`[UserContext] Initializing... host=${isElectronHost()}`)
|
||||
try {
|
||||
if (isElectronHost()) {
|
||||
const api = (window as any).electronAPI || (window as any).electron
|
||||
if (api) {
|
||||
console.log(`[UserContext] Requesting active user from host IPC...`)
|
||||
const invoke = api.invoke || api.ipcRenderer?.invoke || (window as any).ipcRenderer?.invoke
|
||||
if (!invoke) throw new Error("No IPC invoke method found")
|
||||
|
||||
const binder = api.invoke ? api : (api.ipcRenderer || (window as any).ipcRenderer)
|
||||
const activeUser = await invoke.call(binder, "users:active")
|
||||
const api = (window as any).electronAPI
|
||||
if (api && api.getActiveUser) {
|
||||
console.log(`[UserContext] Requesting active user via api.getActiveUser()...`)
|
||||
const activeUser = await api.getActiveUser()
|
||||
console.log(`[UserContext] getActiveUser result:`, activeUser)
|
||||
|
||||
if (activeUser?.id) {
|
||||
console.log(`[UserContext] Host has active session: ${activeUser.id}`)
|
||||
@@ -121,7 +118,7 @@ export async function initializeUserContext(): Promise<void> {
|
||||
setActiveUserId(null)
|
||||
}
|
||||
} else {
|
||||
console.warn(`[UserContext] Electron detected but no IPC bridge found. Falling back to web mode.`)
|
||||
console.warn(`[UserContext] electronAPI.getActiveUser not found. Falling back to web mode.`)
|
||||
await handleWebInit()
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user