mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Use different caches for differents servers
This commit is contained in:
parent
1e55b7bf50
commit
4c84f857e7
@ -32,7 +32,6 @@ import { KyooErrors } from "./kyoo-errors";
|
||||
import { Page, Paged } from "./page";
|
||||
import { Platform } from "react-native";
|
||||
import { getToken } from "./login";
|
||||
import { getSecureItem } from "./secure-store";
|
||||
|
||||
const kyooUrl =
|
||||
Platform.OS !== "web"
|
||||
@ -73,7 +72,7 @@ export const queryFn = async <Data,>(
|
||||
? context.path.filter((x) => x)
|
||||
: context.pageParam
|
||||
? [context.pageParam]
|
||||
: (context.queryKey.filter((x) => x) as string[]),
|
||||
: (context.queryKey.filter((x, i) => x && i) as string[]),
|
||||
)
|
||||
.join("/")
|
||||
.replace("/?", "?");
|
||||
@ -161,6 +160,7 @@ export type QueryPage<Props = {}> = ComponentType<Props> & {
|
||||
const toQueryKey = <Data,>(query: QueryIdentifier<Data>) => {
|
||||
if (query.params) {
|
||||
return [
|
||||
kyooApiUrl,
|
||||
...query.path,
|
||||
"?" +
|
||||
Object.entries(query.params)
|
||||
@ -169,7 +169,7 @@ const toQueryKey = <Data,>(query: QueryIdentifier<Data>) => {
|
||||
.join("&"),
|
||||
];
|
||||
} else {
|
||||
return query.path;
|
||||
return [kyooApiUrl, ...query.path];
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user