Skip to content

Commit

Permalink
fix(app-admin-cognito): add error prop to DefaultContent component (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
leopuleo authored Jun 18, 2024
1 parent 82c8879 commit 8ad56da
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/app-admin-cognito/src/views/SignIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,19 @@ export interface SignInProps {
federatedProviders?: FederatedIdentityProvider[];
}

const DefaultContent = (props: SignInProps) => {
export interface SignInDefaultContentProps extends SignInProps {
error?: Error | null;
}

const DefaultContent = (props: SignInDefaultContentProps) => {
const { submit } = useForm();
const { error } = useSignIn();
const { message, changeState } = useAuthenticator();
const {
title = "Sign In",
description = undefined,
federatedProviders = [],
allowSignInWithCredentials = true
allowSignInWithCredentials = true,
error = null
} = props;

return (
Expand Down Expand Up @@ -111,7 +115,7 @@ const DefaultContent = (props: SignInProps) => {
};

export const SignIn = makeDecoratable("SignIn", (props: SignInProps) => {
const { signIn, loading, shouldRender } = useSignIn();
const { signIn, loading, shouldRender, error } = useSignIn();
const { content = undefined, footer = undefined } = props;

if (!shouldRender) {
Expand All @@ -125,7 +129,7 @@ export const SignIn = makeDecoratable("SignIn", (props: SignInProps) => {
<>
<View.Content>
{loading && <CircularProgress label={"Signing in..."} />}
{content ? content : <DefaultContent {...props} />}
{content ? content : <DefaultContent {...props} error={error} />}
</View.Content>
{footer ? <View.Footer>{footer}</View.Footer> : null}
</>
Expand Down

0 comments on commit 8ad56da

Please sign in to comment.