mirror of
https://github.com/Jellify-Music/App.git
synced 2026-05-08 12:29:30 -05:00
3e4c10cb31
wow there's like no code here lol
21 lines
858 B
TypeScript
21 lines
858 B
TypeScript
import { UseQueryResult, useQuery } from "@tanstack/react-query"
|
|
import * as Keychain from "react-native-keychain"
|
|
import { ArtistModel } from "../../models/ArtistModel"
|
|
import { Api } from "@jellyfin/sdk"
|
|
import AsyncStorage from "@react-native-async-storage/async-storage"
|
|
import { AsyncStorageKeys } from "../../enums/async-storage-keys"
|
|
import { QueryKeys } from "../../enums/query-keys"
|
|
import { useServerUrl } from "./storage"
|
|
|
|
export const useCredentials = useQuery({
|
|
queryKey: [QueryKeys.Credentials],
|
|
queryFn: () => {
|
|
return Keychain.getInternetCredentials(useServerUrl.data!)
|
|
.then((keychain) => {
|
|
if (!keychain)
|
|
throw new Error("Jellyfin server credentials not stored in keychain");
|
|
|
|
return keychain as Keychain.SharedWebCredentials
|
|
});
|
|
}
|
|
}); |