Let's implement the sign-out page in SignOutPage.tsx, which is similar in structure to the SignInPage component:
import React, { FC } from 'react';
import { Page } from './Page';
import { StatusText } from './Styles';
import { useAuth } from './Auth';
type SignoutAction = 'signout' | 'signout-callback';
interface Props {
action: SignoutAction;
}
export const SignOutPage: FC<Props> = ({ action }) => {
let message = 'Signing out ...';
const { signOut } = useAuth();
switch (action) {
case 'signout':
signOut();
break;
case 'signout-callback':
message = 'You successfully signed out!';
break;
}
return (
<Page title="Sign out">
<StatusText>{message}</StatusText>
</Page>
);
};
A slight difference is that when the component receives the callback, this component will stay in view with a message informing them that they have been successfully signed out.