From cc8a5a744f632acec4feccbea303bcc108186995 Mon Sep 17 00:00:00 2001 From: Violet Caulfield Date: Wed, 16 Oct 2024 05:57:12 -0500 Subject: [PATCH] wiring up a context for shaking the login state, let's see if she builds *fingers crossed* --- components/Login/component.tsx | 31 ++++++++++++++++--- components/Login/helpers/server-address.tsx | 11 +++---- .../Login/helpers/server-authentication.tsx | 1 - components/jellify.tsx | 24 +++++++++++--- 4 files changed, 49 insertions(+), 18 deletions(-) diff --git a/components/Login/component.tsx b/components/Login/component.tsx index fb377dbd..4429071c 100644 --- a/components/Login/component.tsx +++ b/components/Login/component.tsx @@ -1,16 +1,37 @@ -import _, { isError } from "lodash" +import _ from "lodash" import ServerAuthentication from "./helpers/server-authentication"; import ServerAddress from "./helpers/server-address"; import { useServer } from "../../api/queries/keychain"; import { View } from "react-native"; +import { createStackNavigator } from "@react-navigation/stack"; +import { useState } from "react"; export default function Login(): React.JSX.Element { - let { isError } = useServer; + let { isError, data } = useServer; + + const Stack = createStackNavigator(); + + let [loginState, setLoginState] = useState({}) return ( - - { isError ? : } - + + { + (isError || _.isUndefined(data) || _.isEmpty(data.version)) ? ( + + + ) : ( + + ) + } + ); } \ No newline at end of file diff --git a/components/Login/helpers/server-address.tsx b/components/Login/helpers/server-address.tsx index 63e216e8..d6273189 100644 --- a/components/Login/helpers/server-address.tsx +++ b/components/Login/helpers/server-address.tsx @@ -1,19 +1,16 @@ import React, { useState } from "react"; import _ from "lodash"; -import { serverUrlMutation } from "../../../api/mutators/storage"; -import { Button, SafeAreaView, TextInput, useColorScheme, View } from "react-native"; -import { Jellyfin } from "@jellyfin/sdk"; -import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api"; +import { Button, TextInput, useColorScheme, View } from "react-native"; import AsyncStorage from "@react-native-async-storage/async-storage"; import { useMutation } from "@tanstack/react-query"; -import { client } from "../../../api/queries"; import { AsyncStorageKeys } from "../../../enums/async-storage-keys"; import { JellifyServer } from "../../../types/JellifyServer"; import { serverMutation } from "../../../api/mutators/functions/storage"; +import { useServer } from "../../../api/queries/keychain"; export default function ServerAddress(): React.JSX.Element { - const [serverUrl, setServerUrl] = useState(""); + const [serverUrl, setServerUrl] = useState(useServer.data?.url ?? ""); const isDarkMode = useColorScheme() === 'dark'; @@ -51,7 +48,7 @@ export default function ServerAddress(): React.JSX.Element {