Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 登入Login 配置及 remove unnecessary code #28

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading