From 3ee3226339008735173384ff3d794b0e4a24dd49 Mon Sep 17 00:00:00 2001 From: Violet Caulfield Date: Sun, 20 Oct 2024 10:12:12 -0500 Subject: [PATCH] trying to get the library screen to navigate back to the login screen --- api/mutators/keychain.ts | 7 +++++++ components/Login/helpers/server-library.tsx | 5 ++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/api/mutators/keychain.ts b/api/mutators/keychain.ts index e69de29b..c06e51b6 100644 --- a/api/mutators/keychain.ts +++ b/api/mutators/keychain.ts @@ -0,0 +1,7 @@ +import { useMutation } from "@tanstack/react-query"; +import { mutateServerCredentials } from "./functions/storage"; + + +export const serverCredentials = useMutation({ + mutationFn: mutateServerCredentials +}); \ No newline at end of file diff --git a/components/Login/helpers/server-library.tsx b/components/Login/helpers/server-library.tsx index 54296868..bef25909 100644 --- a/components/Login/helpers/server-library.tsx +++ b/components/Login/helpers/server-library.tsx @@ -6,6 +6,7 @@ import { JellifyLibrary } from "../../../types/JellifyLibrary"; import { useLibraries } from "../../../api/queries/libraries"; import { client } from "../../../api/client"; import { mutateServerCredentials } from "../../../api/mutators/functions/storage"; +import { serverCredentials } from "../../../api/mutators/keychain"; export default function ServerLibrary(): React.JSX.Element { @@ -21,9 +22,6 @@ export default function ServerLibrary(): React.JSX.Element { const clearUser = useMutation({ mutationFn: async () => { setUsername(undefined) - - mutateServerCredentials() - // Reset API client so that we don't attempt to auth as a user setApiClient(client.createApi(server!.url)) return Promise.resolve(); @@ -37,6 +35,7 @@ export default function ServerLibrary(): React.JSX.Element {