Skip to content

Commit

Permalink
client: fix loading svg for both login btns
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubham-Lal committed Jun 4, 2024
1 parent 2039f9d commit 52bbc93
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions client/src/components/modal/auth/login-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ const LoginTab = () => {
toast.error(response.message)
}
})
.catch(() => setIsAuthenticated(AuthStatus.Failed));
.catch(() => setIsAuthenticated(AuthStatus.Failed))
.finally(() => setIsSubmitted(false));
}
};

Expand All @@ -92,7 +93,7 @@ const LoginTab = () => {
className='google-btn'
onClick={() => window.location.href = `${import.meta.env.VITE_SERVER_URL}/api/auth/google`}
>
{isAuthenticated === AuthStatus.Authenticating ? <LoadingSVG size={23} /> : (
{isAuthenticated === AuthStatus.Authenticating && !isSubmitted ? <LoadingSVG size={23} /> : (
<>
<FcGoogle size={25} />
<span>Signin with Google</span>
Expand Down Expand Up @@ -131,7 +132,7 @@ const LoginTab = () => {
/>
</div>
<button type='submit' disabled={isAuthenticated === AuthStatus.Authenticating}>
{isAuthenticated === AuthStatus.Authenticating ? <LoadingSVG size={23} /> : 'Login'}
{isAuthenticated === AuthStatus.Authenticating && isSubmitted ? <LoadingSVG size={23} /> : 'Login'}
</button>
<p>New here? <span onClick={() => setAuthTab(AuthTab.Signup)}>Create Account</span></p>
</form>
Expand Down

0 comments on commit 52bbc93

Please sign in to comment.