Skip to content

Commit 07b6a2c

Browse files
SharanRPPriteshKiriamityt
authored
fix(login): prevent multiple error toasts on login by clearing previous toasts (#5312)
Signed-off-by: SharanRP <[email protected]> Co-authored-by: Pritesh Kiri <[email protected]> Co-authored-by: Amit Kumar Das <[email protected]>
1 parent dce7673 commit 07b6a2c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

chaoscenter/web/src/controllers/Login/LoginPage.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useSearchParams } from '@hooks';
1111

1212
const LoginController: React.FC = () => {
1313
const history = useHistory();
14-
const { showError } = useToaster();
14+
const { showError, clear } = useToaster();
1515
const searchParams = useSearchParams();
1616

1717
const dexToken = searchParams.get('jwtToken');
@@ -37,13 +37,15 @@ const LoginController: React.FC = () => {
3737
const { isLoading, mutate: handleLogin } = useLoginMutation(
3838
{},
3939
{
40-
onError: err =>
40+
onError: err => {
41+
clear();
4142
showError(
4243
toTitleCase({
4344
separator: '_',
4445
text: err.error ?? ''
4546
})
46-
),
47+
);
48+
},
4749
onSuccess: response => {
4850
if (response.accessToken) {
4951
setUserDetails(response);

0 commit comments

Comments
 (0)