Fix browse page

This commit is contained in:
Zoe Roux 2023-06-08 17:31:38 +09:00
parent 0969d68adc
commit 2b33191db7
5 changed files with 10 additions and 8 deletions

View File

@ -93,7 +93,6 @@ const App = () => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const info = initialRender ? useContext(AccountContext) : useAccounts();
initialRender = false;
console.log(info);
if (info.type === "loading") return <CircularProgress />
if (info.type === "error") return <ConnectionError error={info.error} retry={info.retry} />;
if (info.selected === null) return <Redirect href="/login" />;

View File

@ -64,7 +64,7 @@ module.exports = addMonorepoSupport(
...defaultConfig.resolver,
requireCycleIgnorePatterns: [
...defaultConfig.resolver.requireCycleIgnorePatterns,
/login.ts/,
/.*/,
],
},
}),

View File

@ -41,6 +41,8 @@ const kyooUrl =
? process.env.KYOO_URL ?? "http://localhost:5000"
: "/api";
export let kyooApiUrl: string | null = kyooUrl || null;
export const queryFn = async <Data,>(
context:
| QueryFunctionContext
@ -57,6 +59,7 @@ export const queryFn = async <Data,>(
// @ts-ignore
let url: string | null = context.apiUrl ?? (Platform.OS !== "web" ? await getSecureItem("apiUrl") : null) ?? kyooUrl;
if (!url) console.error("Kyoo's url is not defined.");
kyooApiUrl = url;
// @ts-ignore
if (!token && context.authenticated !== false) token = await getToken();

View File

@ -20,11 +20,12 @@
import { Platform } from "react-native";
import { z } from "zod";
import { kyooApiUrl } from "..";
export const imageFn = (url: string) =>
Platform.OS === "web"
? `/api${url}`
: process.env.PUBLIC_BACK_URL + url;
: kyooApiUrl + url;
export const ImagesP = z.object({
/**

View File

@ -44,17 +44,16 @@ export const Icon = ({ icon: Icon, color, size = 24, ...props }: IconProps) => {
const computed = css(
{ width: size, height: size, fill: color ?? theme.contrast } as any,
props,
);
) as any;
return (
<Icon
{...Platform.select<SvgProps>({
web: computed,
default: {
height: computed.style?.height,
width: computed.style?.width,
// // @ts-ignore
// fill: computed.style?.fill,
height: computed.style[0]?.height,
width: computed.style[0]?.width,
fill: computed.style[0]?.fill,
...computed,
},
})}