From 2cd2f92e9e0c82eaa5f21fe0c30e20ebea7aba24 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Fri, 22 Mar 2024 15:10:24 +0000 Subject: fix(mobile): Fix setting propagatin --- apps/mobile/lib/session.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'apps/mobile/lib/session.ts') diff --git a/apps/mobile/lib/session.ts b/apps/mobile/lib/session.ts index 071748b9..bafb3a09 100644 --- a/apps/mobile/lib/session.ts +++ b/apps/mobile/lib/session.ts @@ -1,20 +1,21 @@ -import { useCallback, useMemo } from "react"; +import { useCallback } from "react"; import useAppSettings from "./settings"; export function useSession() { - const { settings, isLoading, setSettings } = useAppSettings(); - const isLoggedIn = useMemo(() => { - return isLoading ? undefined : !!settings.apiKey; - }, [isLoading, settings]); + const { settings, setSettings } = useAppSettings(); const logout = useCallback(() => { setSettings({ ...settings, apiKey: undefined }); }, [settings, setSettings]); return { - isLoggedIn, - isLoading, logout, }; } + +export function useIsLoggedIn() { + const { settings, isLoading } = useAppSettings(); + + return isLoading ? undefined : !!settings.apiKey; +} -- cgit v1.2.3-70-g09d2