Skip to content

Commit

Permalink
Merge pull request #652 from ClimateMind/650-adjust-frontend-code-to-…
Browse files Browse the repository at this point in the history
…handle-google-oauth

Closes [650] - Adjust frontend code to handle google oauth
  • Loading branch information
epixieme authored Aug 26, 2024
2 parents 53b2d4f + 0cbe445 commit 69f5d86
Show file tree
Hide file tree
Showing 8 changed files with 218 additions and 166 deletions.
41 changes: 38 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
"@emotion/styled": "^11.11.5",
"@mui/icons-material": "^5.16.6",
"@mui/material": "^5.15.18",
"@react-oauth/google": "^0.12.1",
"@reduxjs/toolkit": "^2.2.5",
"@sentry/cli": "^2.32.1",
"@sentry/react": "^7.114.0",
"@sentry/tracing": "^7.114.0",
"@tanstack/react-query": "^5.51.21",
"axios": "^1.7.3",
"chart.js": "^4.4.3",
"gapi-script": "^1.2.0",
"js-cookie": "^3.0.5",
"jwt-decode": "^4.0.0",
"react": "^18.3.1",
Expand Down
1 change: 1 addition & 0 deletions src/api/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export type Login = {

export type googleLogin = {
message: string;
access_token: string;
user: {
email: string;
first_name: string;
Expand Down
9 changes: 3 additions & 6 deletions src/features/auth/components/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ interface Props {
isLoading: boolean;
onLogin: (email: string, password: string) => void;
onForgotPasswordClick: () => void;
handleGoogleAuth?: () => void;
}

function LoginForm({ isLoading, onLogin, onForgotPasswordClick, handleGoogleAuth }: Props) {
const devMode = localStorage.getItem('devMode') === 'true';

function LoginForm({ isLoading, onLogin, onForgotPasswordClick }: Props) {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');

Expand All @@ -36,15 +33,15 @@ function LoginForm({ isLoading, onLogin, onForgotPasswordClick, handleGoogleAuth
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'space-between', alignItems: 'center', marginTop: 30, gap: 20 }}>
<CmButton2 text="Log In" type="submit" isLoading={isLoading} disabled={!email || !password} onClick={handleSubmit} />

{devMode && (
{/* {devMode && (
<CmButton2
text="Log In with Google"
isLoading={isLoading}
onClick={handleGoogleAuth}
startIcon={<img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/google/google-original.svg" style={{ width: 24, height: 24 }} />}
style={{ background: 'white', boxShadow: '0px 2px 3px 0px #0000002B, 0px 0px 3px 0px #00000015', border: 'none' }}
/>
)}
)} */}
</div>
</form>
);
Expand Down
Loading

0 comments on commit 69f5d86

Please sign in to comment.