Skip to content

Commit

Permalink
cleaned and refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
epixieme committed Sep 2, 2024
1 parent a6d0dbc commit 866027b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 0 additions & 4 deletions src/features/auth/components/SignUpForm.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';

import { CmButton2, CmTextInput } from 'shared/components';
import { useLogin } from '../hooks';
import GoogleLogin from './GoogleLogin';

interface Props {
isLoading: boolean;
onSignUp: (firstname: string, lastname: string, email: string, password: string) => void;
Expand Down
2 changes: 1 addition & 1 deletion src/features/auth/hooks/useLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function useLogin() {
throw new Error('No credential received from Google');
}

const data = await postGoogleLogin(response);
const data = await postGoogleLogin(response.toString());

showSuccessToast(`Welcome back, ${data.user.first_name}!`);
const { first_name, last_name, email, quiz_id, user_uuid } = data.user;
Expand Down
8 changes: 5 additions & 3 deletions src/pages/UserAUnauthorizedPages/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ function LoginPage() {
{isMobile && <CmBackButton onClick={() => navigate(-1)} style={styles.backButton} />}
<img src="/logos/cm-logo.png" alt="Climate Mind Logo" style={styles.logo} />
<img src="/logos/slogan.png" alt="Climate Mind Logo" style={styles.slogan} />
<LoginForm isLoading={isLoading} onLogin={handleSubmit} onForgotPasswordClick={() => setShowPasswordResetModal(true)} />
<div style={{ borderBottom: '1px solid #0000001A', height: 1, width: 205 }}></div>
{devMode && <GoogleLogin navigateAfterLogin={navigateAfterLogin} text="Log In With Google" />}
<div style={{ display: 'flex', flexDirection: 'column', gap: 19, justifyContent: 'center', alignItems: 'center' }}>
<LoginForm isLoading={isLoading} onLogin={handleSubmit} onForgotPasswordClick={() => setShowPasswordResetModal(true)} />
<div style={{ borderBottom: '1px solid #0000001A', height: 1, width: 205 }}></div>
{devMode && <GoogleLogin navigateAfterLogin={navigateAfterLogin} text="Log In With Google" />}
</div>
<RequestPasswordResetModal isOpen={showPasswordResetModal} onClose={() => setShowPasswordResetModal(false)} onSubmit={handlePasswordReset} />
</PageContent>
</Page>
Expand Down
8 changes: 5 additions & 3 deletions src/pages/UserAUnauthorizedPages/SignUpPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ function SignUpPage() {
<CmTypography variant="body" style={{ margin: 0, textAlign: 'center' }}>
Save your results, see your climate topics, and start talking.
</CmTypography>

<SignUpForm isLoading={isLoading} onSignUp={signUpHandler} />
<GoogleLogin navigateAfterLogin={navigateAfterLogin} text="Continue With Google" />
<div style={{ display: 'flex', flexDirection: 'column', gap: 19, justifyContent: 'center', alignItems: 'center' }}>
<SignUpForm isLoading={isLoading} onSignUp={signUpHandler} />
<div style={{ borderBottom: '1px solid #0000001A', height: 1, width: 205 }}></div>
<GoogleLogin navigateAfterLogin={navigateAfterLogin} text="Continue With Google" />
</div>
</PageContent>
</Page>
);
Expand Down

0 comments on commit 866027b

Please sign in to comment.