fix: resolve ReferenceError and strengthen IPC invocation in login flow
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:
@@ -150,7 +150,7 @@ const LoginView: Component<LoginViewProps> = (props) => {
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isLoggingIn() || !selectedUserId()}
|
disabled={isLoggingIn() || !username()}
|
||||||
class="w-full flex items-center justify-center gap-3 py-4 bg-gradient-to-r from-blue-600 via-indigo-600 to-purple-600 hover:from-blue-500 hover:to-purple-500 text-white font-bold rounded-2xl shadow-xl shadow-blue-900/20 transform active:scale-[0.98] transition-all disabled:opacity-50 disabled:cursor-not-allowed group"
|
class="w-full flex items-center justify-center gap-3 py-4 bg-gradient-to-r from-blue-600 via-indigo-600 to-purple-600 hover:from-blue-500 hover:to-purple-500 text-white font-bold rounded-2xl shadow-xl shadow-blue-900/20 transform active:scale-[0.98] transition-all disabled:opacity-50 disabled:cursor-not-allowed group"
|
||||||
>
|
>
|
||||||
<Show when={isLoggingIn()} fallback={
|
<Show when={isLoggingIn()} fallback={
|
||||||
|
|||||||
@@ -107,7 +107,11 @@ export async function initializeUserContext(): Promise<void> {
|
|||||||
const api = (window as any).electronAPI || (window as any).electron
|
const api = (window as any).electronAPI || (window as any).electron
|
||||||
if (api) {
|
if (api) {
|
||||||
console.log(`[UserContext] Requesting active user from host IPC...`)
|
console.log(`[UserContext] Requesting active user from host IPC...`)
|
||||||
const activeUser = await (api.invoke ? api.invoke("users:active") : api.ipcRenderer.invoke("users:active"))
|
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")
|
||||||
|
|
||||||
if (activeUser?.id) {
|
if (activeUser?.id) {
|
||||||
console.log(`[UserContext] Host has active session: ${activeUser.id}`)
|
console.log(`[UserContext] Host has active session: ${activeUser.id}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user