Skip to content

Commit

Permalink
Merge pull request #28 from daodaoedu/fix/1.2_google_login
Browse files Browse the repository at this point in the history
fix: 登入Login 配置及 remove unnecessary code
  • Loading branch information
hsuifang authored Jan 16, 2024
2 parents e6179ab + 0dc8292 commit f9b9fd7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 34 deletions.
51 changes: 25 additions & 26 deletions pages/login/index.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import React, { useEffect, useMemo } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import React, { useMemo } from 'react';
import styled from '@emotion/styled';
import Router, { useRouter } from 'next/router';
import { useRouter } from 'next/router';
import Link from '@mui/material/Link';
import Script from 'next/script';
import { Box, Typography, Button, Skeleton } from '@mui/material';
import { LazyLoadImage } from 'react-lazy-load-image-component';
import toast from 'react-hot-toast';
import { getAuth, GoogleAuthProvider, signInWithPopup } from 'firebase/auth';
import { getFirestore, doc, getDoc } from 'firebase/firestore';
import SEOConfig from '../../shared/components/SEO';
import Navigation from '../../shared/components/Navigation_v2';
import Footer from '../../shared/components/Footer_v2';
import SEOConfig from '@/shared/components/SEO';
import Navigation from '@/shared/components/Navigation_v2';
import Footer from '@/shared/components/Footer_v2';
// import sendDataToChromeExtension from '../../utils/sendDataToChromeExtension';

const HomePageWrapper = styled.div`
Expand Down Expand Up @@ -40,6 +37,10 @@ const ContentWrapper = styled.div`
`;

const LoginPage = () => {
const BASEURL = `${
process.env.NEXT_PUBLIC_API_URL || 'https://daodao-server.onrender.com'
}`;
const LOGINPATH = `${BASEURL}/auth/google`;
const router = useRouter();

const SEOData = useMemo(
Expand Down Expand Up @@ -107,23 +108,21 @@ const LoginPage = () => {
/>
}
/>
<Button
sx={{
marginTop: '24px',
width: '100%',
borderRadius: '20px',
color: '#fff',
bgcolor: '#16B9B3',
boxShadow: '0px 4px 10px rgba(89, 182, 178, 0.5)',
}}
variant="contained"
onClick={() => {
onLogin();
// toast.success('你點我做什麼????');
}}
>
Google 登入 / 註冊
</Button>
<Link href={LOGINPATH} target="_blank" rel="noreferrer noopener">
<Button
sx={{
marginTop: '24px',
width: '100%',
borderRadius: '20px',
color: '#fff',
bgcolor: '#16B9B3',
boxShadow: '0px 4px 10px rgba(89, 182, 178, 0.5)',
}}
variant="contained"
>
Google 登入 / 註冊
</Button>
</Link>
<Box sx={{ marginTop: '24px' }}>
<Typography sx={{ color: '#536166', fontSize: '14px' }}>
{`註冊即代表您同意島島阿學的 `}
Expand Down
2 changes: 1 addition & 1 deletion pages/signin/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function EditPage() {
isSubscribeEmail,
};
dispatch(updateUser(payload));
router.push(`/signin/interest?id=${id}`);
router.push(`/signin/interest`);
};

const SEOData = useMemo(
Expand Down
10 changes: 3 additions & 7 deletions pages/signin/interest/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ import {
EDUCATION_STEP,
WANT_TO_DO_WITH_PARTNER,
CATEGORIES,
} from '../../../constants/member';
import TipModal from '../../../components/Signin/Interest/TipModal';
import COUNTIES from '../../../constants/countries.json';
} from '@/constants/member';
import TipModal from '@/components/Signin/Interest/TipModal';

const HomePageWrapper = styled.div`
--section-height: calc(100vh - 80px);
Expand Down Expand Up @@ -67,10 +66,7 @@ function EditPage() {
if (userId) {
setInterestList(userInterestList);
}
if (id) {
dispatch(fetchUserById(id));
}
}, [userId, id]);
}, [userId]);

const onUpdateUser = (successCallback) => {
const payload = {
Expand Down

1 comment on commit f9b9fd7

@vercel
Copy link

@vercel vercel bot commented on f9b9fd7 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

daodao-f2e – ./

daodao-f2e-daodaoedu.vercel.app
daodao-f2e-git-dev-daodaoedu.vercel.app
daodao-f2e.vercel.app

Please sign in to comment.