mirror of
https://github.com/Jellify-Music/App.git
synced 2026-05-20 11:59:01 -05:00
okokokokok
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { useState } from "react";
|
||||
import _ from "lodash";
|
||||
import { RadioGroup, RadioButton, TextField, View, Button, Card } from 'react-native-ui-lib';
|
||||
import { RadioGroup, RadioButton, TextField, View, Button, Card, Colors } from 'react-native-ui-lib';
|
||||
import { useColorScheme } from "react-native";
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
@@ -15,7 +15,7 @@ const https = "https://"
|
||||
|
||||
export default function ServerAddress(): React.JSX.Element {
|
||||
|
||||
const loginContext = useApiClientContext();
|
||||
const { setChangeServer, setServer } = useApiClientContext();
|
||||
|
||||
const [protocol, setProtocol] = useState(https)
|
||||
const [serverAddress, setServerAddress] = useState("");
|
||||
@@ -41,6 +41,8 @@ export default function ServerAddress(): React.JSX.Element {
|
||||
startUpComplete: publicSystemInfoResponse.data.StartupWizardCompleted!
|
||||
}
|
||||
|
||||
setChangeServer(false);
|
||||
setServer(jellifyServer);
|
||||
return await mutateServer(jellifyServer);
|
||||
},
|
||||
onError: async (error: Error) => {
|
||||
@@ -58,10 +60,12 @@ export default function ServerAddress(): React.JSX.Element {
|
||||
<RadioButton
|
||||
value={https}
|
||||
label={"HTTPS"}
|
||||
labelStyle={{color: Colors.$textGeneral}}
|
||||
/>
|
||||
<RadioButton
|
||||
value={http}
|
||||
label={'HTTP'}
|
||||
labelStyle={{color: Colors.$textGeneral}}
|
||||
/>
|
||||
</RadioGroup>
|
||||
</View>
|
||||
|
||||
@@ -12,16 +12,12 @@ export default function ServerAuthentication(): React.JSX.Element {
|
||||
|
||||
const isDarkMode = useColorScheme() === 'dark';
|
||||
|
||||
const loginContext = useApiClientContext();
|
||||
|
||||
useEffect(() => {
|
||||
loginContext.setChangeServer(false);
|
||||
});
|
||||
const { setServer, setChangeServer } = useApiClientContext();
|
||||
|
||||
const clearServer = useMutation({
|
||||
mutationFn: async () => {
|
||||
loginContext.setServer(undefined)
|
||||
loginContext.setChangeServer(true);
|
||||
setServer(undefined)
|
||||
setChangeServer(true);
|
||||
return await AsyncStorage.setItem(AsyncStorageKeys.ServerUrl, "");
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user