mirror of
https://github.com/Jellify-Music/App.git
synced 2026-01-07 19:40:19 -06:00
get the login flow to go
This commit is contained in:
@@ -18,9 +18,11 @@ export const fetchCredentials : () => Promise<Keychain.SharedWebCredentials> = (
|
||||
|
||||
const keychain = await Keychain.getInternetCredentials(serverUrl!);
|
||||
|
||||
if (!keychain)
|
||||
if (!keychain) {
|
||||
console.warn("No keychain for server address - signin required");
|
||||
throw new Error("Unable to retrieve credentials for server address from keychain");
|
||||
|
||||
}
|
||||
|
||||
resolve(keychain as Keychain.SharedWebCredentials)
|
||||
});
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ export default function Jellify(): React.JSX.Element {
|
||||
};
|
||||
|
||||
let jellifyServer = useServer;
|
||||
let { data, isError, isSuccess, isPending } = useCredentials;
|
||||
let credentials = useCredentials;
|
||||
|
||||
const [keychain, setKeychain] = useState(data);
|
||||
const [keychain, setKeychain] : [SharedWebCredentials | undefined, React.Dispatch<React.SetStateAction<SharedWebCredentials | undefined>> ]= useState();
|
||||
const [server, setServer] = useState(jellifyServer.data)
|
||||
|
||||
const loginContextFns = {
|
||||
@@ -40,7 +40,7 @@ export default function Jellify(): React.JSX.Element {
|
||||
|
||||
|
||||
return (
|
||||
(isPending) ? (
|
||||
(credentials.isPending) ? (
|
||||
<SafeAreaView style={jellifyStyles.container}>
|
||||
<Text>Logging in</Text>
|
||||
<ActivityIndicator />
|
||||
@@ -49,7 +49,7 @@ export default function Jellify(): React.JSX.Element {
|
||||
<LoginContext.Provider value={{keychain, server, loginContextFns}}>
|
||||
<NavigationContainer>
|
||||
<SafeAreaView style={jellifyStyles.container}>
|
||||
{ (isSuccess && !_.isUndefined(data)) ? <Navigation /> : <Login /> }
|
||||
{ (credentials.isSuccess && !_.isUndefined(credentials.data)) ? <Navigation /> : <Login /> }
|
||||
</SafeAreaView>
|
||||
</NavigationContainer>
|
||||
</LoginContext.Provider>
|
||||
|
||||
Reference in New Issue
Block a user