-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DEV-1465] Reset login form errors on user changes (#692)
* refactor login form * handle reset errors on change input value * add LoginForm tests * add test * Create sour-penguins-smile.md * Moved test file * fix error prop value * improve test * pr changes * minor fixes * changes after review * Update .changeset/sour-penguins-smile.md Co-authored-by: marcobottaro <[email protected]> --------- Co-authored-by: marcobottaro <[email protected]>
- Loading branch information
1 parent
f250a26
commit ffde2ad
Showing
6 changed files
with
259 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"nextjs-website": patch | ||
--- | ||
|
||
Reset login form errors on user changes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
apps/nextjs-website/src/components/organisms/Auth/AuthStatus.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use client'; | ||
import { useAuthenticator } from '@aws-amplify/ui-react'; | ||
import { redirect } from 'next/navigation'; | ||
import { PropsWithChildren } from 'react'; | ||
|
||
export default function AuthStatus({ children }: PropsWithChildren) { | ||
const { authStatus } = useAuthenticator((context) => [context.authStatus]); | ||
|
||
if (authStatus === 'authenticated') { | ||
redirect('/'); | ||
} | ||
|
||
return children; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.