diff options
| author | MohamedBassem <me@mbassem.com> | 2024-03-22 15:10:24 +0000 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-03-22 15:14:24 +0000 |
| commit | 2cd2f92e9e0c82eaa5f21fe0c30e20ebea7aba24 (patch) | |
| tree | acf86f033b976a40079c3efe8ec1fb727ae2a452 /apps/mobile/lib/session.ts | |
| parent | 95cc9e6ff29cd39dc80aa09c80a6d1c9489b5d6a (diff) | |
| download | karakeep-2cd2f92e9e0c82eaa5f21fe0c30e20ebea7aba24.tar.zst | |
fix(mobile): Fix setting propagatin
Diffstat (limited to 'apps/mobile/lib/session.ts')
| -rw-r--r-- | apps/mobile/lib/session.ts | 15 |
1 files changed, 8 insertions, 7 deletions
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; +} |
