Files
astuto/app/javascript/components/SiteSettings/Authentication/AuthenticationFormPage.tsx
Riccardo Graziosi 4c73b398e8 Add OAuth2 authentication (#147)
- Added Site settings > Authentication section
- Create/edit/delete your custom oauth2 configurations
- Login or signup with oauth2
2022-08-05 18:15:17 +02:00

46 lines
1.2 KiB
TypeScript

import * as React from 'react';
import I18n from 'i18n-js';
import Box from '../../common/Box';
import { AuthenticationPages } from './AuthenticationSiteSettingsP';
import OAuthForm, { ISiteSettingsOAuthForm } from './OAuthForm';
import Spinner from '../../common/Spinner';
import { DangerText } from '../../common/CustomTexts';
import { IOAuth } from '../../../interfaces/IOAuth';
interface Props {
handleSubmitOAuth(oAuth: IOAuth): void;
handleUpdateOAuth(id: number, form: ISiteSettingsOAuthForm): void;
isSubmitting: boolean;
submitError: string;
selectedOAuth: IOAuth;
page: AuthenticationPages;
setPage: React.Dispatch<React.SetStateAction<AuthenticationPages>>;
}
const AuthenticationFormPage = ({
handleSubmitOAuth,
handleUpdateOAuth,
isSubmitting,
submitError,
selectedOAuth,
page,
setPage,
}: Props) => (
<>
<Box customClass="authenticationFormPage">
<OAuthForm
handleSubmitOAuth={handleSubmitOAuth}
handleUpdateOAuth={handleUpdateOAuth}
selectedOAuth={selectedOAuth}
page={page}
setPage={setPage}
/>
{ isSubmitting && <Spinner /> }
{ submitError && <DangerText>{submitError}</DangerText> }
</Box>
</>
);
export default AuthenticationFormPage;