mirror of
https://github.com/Jellify-Music/App.git
synced 2026-02-16 15:38:59 -06:00
getting api client to get added to context when signed in Server name should stay on auth screen even when a different server address is requested
49 lines
1.8 KiB
TypeScript
49 lines
1.8 KiB
TypeScript
import _ from "lodash"
|
|
import ServerAuthentication from "./helpers/server-authentication";
|
|
import ServerAddress from "./helpers/server-address";
|
|
import { createStackNavigator } from "@react-navigation/stack";
|
|
import { useApiClientContext } from "../jellyfin-api-provider";
|
|
import ServerLibrary from "./helpers/server-library";
|
|
|
|
export default function Login(): React.JSX.Element {
|
|
|
|
const { server, changeServer, username } = useApiClientContext();
|
|
|
|
const Stack = createStackNavigator();
|
|
|
|
return (
|
|
<Stack.Navigator screenOptions={{ headerShown: false }}>
|
|
{
|
|
(_.isUndefined(server) || _.isEmpty(server.url) || changeServer) ? (
|
|
<Stack.Screen
|
|
name="ServerAddress"
|
|
options={{
|
|
headerShown: false,
|
|
animationTypeForReplace: 'pop'
|
|
}}
|
|
component={ServerAddress}
|
|
/>
|
|
) : (
|
|
|
|
(_.isUndefined(username)) ? (
|
|
<Stack.Screen
|
|
name="ServerAuthentication"
|
|
options={{
|
|
headerShown: false
|
|
}}
|
|
component={ServerAuthentication}
|
|
/>
|
|
) : (
|
|
<Stack.Screen
|
|
name="LibrarySelection"
|
|
options={{
|
|
headerShown: false
|
|
}}
|
|
component={ServerLibrary}
|
|
/>
|
|
)
|
|
)
|
|
}
|
|
</Stack.Navigator>
|
|
);
|
|
} |