This commit is contained in:
Violet Caulfield
2024-10-22 15:28:31 -05:00
parent 18b016859a
commit 2eb01bc08e
2 changed files with 5 additions and 5 deletions

View File

@@ -33,13 +33,13 @@ export const mutateServer = async (server?: JellifyServer) => {
return await AsyncStorage.removeItem(AsyncStorageKeys.ServerUrl);
}
export const mutateServerCredentials = async (credentials?: JellyfinCredentials) => {
export const mutateServerCredentials = async (serverUrl: string, credentials?: JellyfinCredentials) => {
if (!_.isUndefined(credentials)) {
console.log("Setting Jellyfin credentials")
return await Keychain.setInternetCredentials((await fetchServer()).url, credentials.username, credentials.accessToken!);
return await Keychain.setInternetCredentials(serverUrl, credentials.username, credentials.accessToken!);
}
console.log("Resetting Jellyfin credentials")
return await Keychain.resetInternetCredentials((await fetchServer()).url);
return await Keychain.resetInternetCredentials(serverUrl);
}

View File

@@ -19,7 +19,7 @@ export default function ServerLibrary(): React.JSX.Element {
const [musicLibrary, setMusicLibrary] = useState<JellifyLibrary | undefined>(undefined);
const { setUsername, setChangeUsername, libraryName, setLibraryName, libraryId, setLibraryId } = useAuthenticationContext();
const { server, setUsername, setChangeUsername, libraryName, setLibraryName, libraryId, setLibraryId } = useAuthenticationContext();
const { apiClient, refetchApi } = useApiClientContext();
@@ -33,7 +33,7 @@ export default function ServerLibrary(): React.JSX.Element {
const clearUser = useMutation({
mutationFn: async () => {
await mutateServerCredentials();
await mutateServerCredentials(server!.url);
setChangeUsername(true);
return await refetchApi()
}