06f11a2d08
* refactor(auth): auth client api * fix: build * fix: dependencies * fix: fix T-2777 * fix: fix T-2776 * chore: update type * fix: build * fix: allowSignUp * fix: file name * fix: file name * refactor: client api * fix: build * chore: update name * fix: tsx must be loaded with --import instead of --loader * fix: type * fix: type * fix: type * fix: type * fix: bug * chore: improve wording * fix: test --------- Co-authored-by: chenos <chenlinxh@gmail.com>
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import { css } from '@emotion/css';
|
|
import React from 'react';
|
|
import { Outlet } from 'react-router-dom';
|
|
import { useSystemSettings, PoweredBy, useRequest, useAPIClient } from '@nocobase/client';
|
|
import { AuthenticatorsContext } from '../authenticator';
|
|
|
|
export function AuthLayout(props: any) {
|
|
const { data } = useSystemSettings();
|
|
const api = useAPIClient();
|
|
const { data: authenticators = [], error } = useRequest(() =>
|
|
api
|
|
.resource('authenticators')
|
|
.publicList()
|
|
.then((res) => {
|
|
return res?.data?.data || [];
|
|
}),
|
|
);
|
|
|
|
if (error) {
|
|
throw error;
|
|
}
|
|
|
|
return (
|
|
<div
|
|
style={{
|
|
maxWidth: 320,
|
|
margin: '0 auto',
|
|
paddingTop: '20vh',
|
|
}}
|
|
>
|
|
<h1>{data?.data?.title}</h1>
|
|
<AuthenticatorsContext.Provider value={authenticators as any}>
|
|
<Outlet />
|
|
</AuthenticatorsContext.Provider>
|
|
<div
|
|
className={css`
|
|
position: absolute;
|
|
bottom: 24px;
|
|
width: 100%;
|
|
left: 0;
|
|
text-align: center;
|
|
`}
|
|
>
|
|
<PoweredBy />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|