diff --git a/api/queries/functions/storage.ts b/api/queries/functions/storage.ts index a25fdaa6..0f561fe6 100644 --- a/api/queries/functions/storage.ts +++ b/api/queries/functions/storage.ts @@ -14,7 +14,7 @@ export const fetchCredentials : () => Promise = ( console.debug(`REMOVE THIS::Server name ${server.name}`); if (_.isEmpty(server.url)) { - console.warn("Server url was empty") + console.warn("Server url was empty"); throw new Error("Unable to retrieve credentials without a server URL"); } @@ -25,6 +25,7 @@ export const fetchCredentials : () => Promise = ( throw new Error("Unable to retrieve credentials for server address from keychain"); } + console.log("Successfully retrieved keychain"); resolve(keychain as Keychain.SharedWebCredentials) }); diff --git a/components/Login/helpers/server-authentication.tsx b/components/Login/helpers/server-authentication.tsx index b78eeaf2..00d6f5cf 100644 --- a/components/Login/helpers/server-authentication.tsx +++ b/components/Login/helpers/server-authentication.tsx @@ -17,7 +17,6 @@ export default function ServerAuthentication(): React.JSX.Element { const clearServer = useMutation({ mutationFn: async () => { loginContext.loginContextFns.setKeychainFn(undefined); - loginContext.loginContextFns.setServerFn(undefined); return await AsyncStorage.setItem(AsyncStorageKeys.ServerUrl, ""); } }) diff --git a/components/contexts.ts b/components/contexts.ts index 81b1ce55..f2552548 100644 --- a/components/contexts.ts +++ b/components/contexts.ts @@ -4,12 +4,10 @@ import { JellifyServer } from "../types/JellifyServer"; type LoginContextFns = { setKeychainFn: (state: SharedWebCredentials | undefined) => void, - setServerFn: (state: JellifyServer | undefined) => void } type LoginContext = { keychain: SharedWebCredentials | undefined; - server: JellifyServer | undefined, loginContextFns: LoginContextFns }; /** @@ -18,10 +16,8 @@ type LoginContext = { */ const loginContextDefaultValue : LoginContext = { keychain: undefined, - server: undefined, loginContextFns: { setKeychainFn: (state: SharedWebCredentials | undefined) => {}, // noop default callback - setServerFn: (state: JellifyServer | undefined) => {} } } diff --git a/components/jellify.tsx b/components/jellify.tsx index 9679d1a4..22403924 100644 --- a/components/jellify.tsx +++ b/components/jellify.tsx @@ -23,22 +23,16 @@ export default function Jellify(): React.JSX.Element { backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, }; - let jellifyServer = useServer; let credentials = useCredentials; const [keychain, setKeychain] : [SharedWebCredentials | undefined, React.Dispatch> ]= useState(); - const [server, setServer] = useState(jellifyServer.data) const loginContextFns = { setKeychainFn: (state: SharedWebCredentials | undefined) => { setKeychain(state); - }, - setServerFn: (state: JellifyServer | undefined) => { - setServer(state); } } - return ( (credentials.isPending) ? ( @@ -46,7 +40,7 @@ export default function Jellify(): React.JSX.Element { ) : ( - + { (credentials.isSuccess && !_.isUndefined(credentials.data)) ? : }