mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Disable login page errors on the web
This commit is contained in:
parent
a7fd96800a
commit
c319f6117a
@ -117,10 +117,16 @@ const YoshikiDebug = ({ children }: { children: JSX.Element }) => {
|
|||||||
return <StyleRegistryProvider registry={registry}>{children}</StyleRegistryProvider>;
|
return <StyleRegistryProvider registry={registry}>{children}</StyleRegistryProvider>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ConnectionErrorVerifier = ({ children }: { children: JSX.Element }) => {
|
const ConnectionErrorVerifier = ({
|
||||||
|
children,
|
||||||
|
skipErrors,
|
||||||
|
}: {
|
||||||
|
children: JSX.Element;
|
||||||
|
skipErrors?: boolean;
|
||||||
|
}) => {
|
||||||
const { error } = useContext(ConnectionErrorContext);
|
const { error } = useContext(ConnectionErrorContext);
|
||||||
|
|
||||||
if (!error) return children;
|
if (!error || skipErrors) return children;
|
||||||
return <WithLayout Component={ConnectionError} />;
|
return <WithLayout Component={ConnectionError} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -158,7 +164,7 @@ const App = ({ Component, pageProps }: AppProps) => {
|
|||||||
<PortalProvider>
|
<PortalProvider>
|
||||||
<SnackbarProvider>
|
<SnackbarProvider>
|
||||||
<GlobalCssTheme />
|
<GlobalCssTheme />
|
||||||
<ConnectionErrorVerifier>
|
<ConnectionErrorVerifier skipErrors={(Component as QueryPage).isPublic}>
|
||||||
<WithLayout
|
<WithLayout
|
||||||
Component={Component}
|
Component={Component}
|
||||||
randomItems={
|
randomItems={
|
||||||
|
@ -183,6 +183,7 @@ export type QueryPage<Props = {}, Items = unknown> = ComponentType<
|
|||||||
| { Layout: QueryPage<{ page: ReactElement }>; props: object };
|
| { Layout: QueryPage<{ page: ReactElement }>; props: object };
|
||||||
requiredPermissions?: string[];
|
requiredPermissions?: string[];
|
||||||
randomItems?: Items[];
|
randomItems?: Items[];
|
||||||
|
isPublic?: boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
export const toQueryKey = (query: {
|
export const toQueryKey = (query: {
|
||||||
|
@ -96,5 +96,5 @@ export const LoginPage: QueryPage<{ apiUrl?: string; error?: string }> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
LoginPage.getFetchUrls = () => [OidcLogin.query()];
|
LoginPage.getFetchUrls = () => [OidcLogin.query()];
|
||||||
|
LoginPage.isPublic = true;
|
||||||
LoginPage.getLayout = DefaultLayout;
|
LoginPage.getLayout = DefaultLayout;
|
||||||
|
@ -106,5 +106,5 @@ export const RegisterPage: QueryPage<{ apiUrl?: string }> = ({ apiUrl }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
RegisterPage.getFetchUrls = () => [OidcLogin.query()];
|
RegisterPage.getFetchUrls = () => [OidcLogin.query()];
|
||||||
|
RegisterPage.isPublic = true;
|
||||||
RegisterPage.getLayout = DefaultLayout;
|
RegisterPage.getLayout = DefaultLayout;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user