From 38cf399c76356328e707aaf4f381be136ade70c0 Mon Sep 17 00:00:00 2001 From: JongJin Kim <46832146+SugarSyrup@users.noreply.github.com> Date: Mon, 12 Feb 2024 13:52:44 +0900 Subject: [PATCH] =?UTF-8?q?Revert=20"Feature/#4=20isLoginTemplate=20?= =?UTF-8?q?=EC=99=84=EC=84=B1,=20=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83,=20?= =?UTF-8?q?=EB=8B=89=EB=84=A4=EC=9E=84=20=EC=84=A4=EC=A0=95=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EA=B5=AC=ED=98=84"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 13 +-- src/pages/CollectPersonalData.jsx | 48 ++++----- src/pages/Home.jsx | 173 +++++++++++++++--------------- src/pages/IsLoginTemplate.jsx | 21 ++-- src/service/auth.js | 50 +++------ 5 files changed, 138 insertions(+), 167 deletions(-) diff --git a/.env b/.env index f78f2d6..681570c 100644 --- a/.env +++ b/.env @@ -1,6 +1,7 @@ -REACT_APP_API_KEY="AIzaSyD_HOQiMwjoWg5pSnKb332UCVxE8C_Tl_k" -REACT_APP_AOUT_DOMAIN="growth-memory.firebaseapp.com" -REACT_APP_PROJECT_ID="growth-memory" -REACT_APP_STORAGE_BUCKET="growth-memory.appspot.com" -REACT_APP_MESSAGEING_SENDER_ID="875889764726" -REACT_APP_APP_ID="1:875889764726:web:47ad150f915d82f2beb257" \ No newline at end of file +REACT_APP_API_KEY="AIzaSyAF0pdgtSx3boMRUnIcN3Op0lrySJH_6Ng" +REACT_APP_AOUT_DOMAIN="growthmemory-1ea05.firebaseapp.com" +REACT_APP_PROJECT_ID="growthmemory-1ea05" +REACT_APP_STORAGE_BUCKET="growthmemory-1ea05.appspot.com" +REACT_APP_MESSAGEING_SENDER_ID="1051732433529" +REACT_APP_APP_ID="1:1051732433529:web:7d1d844cf3df322eded2a8" + diff --git a/src/pages/CollectPersonalData.jsx b/src/pages/CollectPersonalData.jsx index fc16a9f..eeec1dc 100644 --- a/src/pages/CollectPersonalData.jsx +++ b/src/pages/CollectPersonalData.jsx @@ -1,7 +1,7 @@ import HeaderBox from "../components/common/header/HeaderBox"; import Button from "../components/common/Button"; import Terms from "../components/common/Terms"; -import TermsBox from "../components/CollectPersonalData/TermsBox"; +import TermsBox from "../components/collectPersonalData/TermsBox"; import styled from "styled-components"; import { Context } from "../components/context/context"; import { useContext } from "react"; @@ -9,30 +9,30 @@ import SignUpProvider from "../components/provider/SignUpPovider"; import BackHeader from "../components/common/header/BackHeader"; export default function CollectPersonalData() { - return ( - <> - - -
- - 서비스 이용을 위해 - {"약관 동의를 해주세요 :)"} - -
-
- - ); + return ( + <> + + +
+ + 서비스 이용을 위해 + {"약관 동의를 해주세요 :)"} + +
+
+ + ); } const Section = styled.section` - width: 360px; - height: 500px; - display: flex; - flex-direction: column; - align-items: center; - justify-content: space-between; - /* background-color: aqua; */ + width: 360px; + height: 500px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + /* background-color: aqua; */ `; diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx index beb0582..ba4b814 100644 --- a/src/pages/Home.jsx +++ b/src/pages/Home.jsx @@ -10,107 +10,106 @@ import { BiSolidMedal } from "react-icons/bi"; //예비1 import { IoRibbonSharp } from "react-icons/io5"; //예비2 import { SlBadge } from "react-icons/sl"; import Navigation from "../components/common/Navigation"; -import { onSignOut } from "../service/auth"; export default function Home() { - return ( - - -
- - - 오늘의 회고를 작성해주세요 - - - -
- - 얼마나 꾸준히 - 했는지 살펴보세요 - -
- -
- -
- - - 성과를 확인해보세요 - -
- -
-
- -
- ); + return ( + + +
+ + + 오늘의 회고를 작성해주세요 + + + +
+ + 얼마나 꾸준히 했는지 + 살펴보세요 + +
+ +
+ +
+ + + 성과를 확인해보세요 + +
+ +
+
+ +
+ ); } const Section = styled.section` - width: 100%; - height: 421px; - display: flex; - flex-direction: column; - align-items: center; + width: 100%; + height: 421px; + display: flex; + flex-direction: column; + align-items: center; `; const Btn = styled.button` - margin-bottom: 27px; - width: 311px; - height: 45px; - border: none; - border-radius: 5px; - color: #f9f9f9; - font-size: 14px; - box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.25); - display: flex; - align-items: center; - position: relative; - background-color: #5ac479; + margin-bottom: 27px; + width: 311px; + height: 45px; + border: none; + border-radius: 5px; + color: #f9f9f9; + font-size: 14px; + box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.25); + display: flex; + align-items: center; + position: relative; + background-color: #5ac479; - .leftIcon { - margin: 0 14px 0 17px; - } - .rigntIcon { - position: absolute; - right: 12px; - } + .leftIcon { + margin: 0 14px 0 17px; + } + .rigntIcon { + position: absolute; + right: 12px; + } `; const CalendarDiv = styled.div` - margin-bottom: 26px; - width: 312px; - height: 200px; + margin-bottom: 26px; + width: 312px; + height: 200px; - .title { - width: 100%; - height: 30px; - font-size: 16px; - font-weight: 600; - } - .pinIcon { - margin-right: 2px; - color: red; - font-size: 18px; - position: relative; - top: 4px; - } + .title { + width: 100%; + height: 30px; + font-size: 16px; + font-weight: 600; + } + .pinIcon { + margin-right: 2px; + color: red; + font-size: 18px; + position: relative; + top: 4px; + } `; const PerformanceDiv = styled.div` - width: 312px; - height: 110px; + width: 312px; + height: 110px; - .title { - width: 100%; - height: 30px; - font-size: 16px; - font-weight: 600; - } - .medalIcon { - margin-right: 2px; - color: #ecef5a; - font-size: 18px; - position: relative; - top: 4px; - } + .title { + width: 100%; + height: 30px; + font-size: 16px; + font-weight: 600; + } + .medalIcon { + margin-right: 2px; + color: #ecef5a; + font-size: 18px; + position: relative; + top: 4px; + } `; diff --git a/src/pages/IsLoginTemplate.jsx b/src/pages/IsLoginTemplate.jsx index 1ce1607..eba0b97 100644 --- a/src/pages/IsLoginTemplate.jsx +++ b/src/pages/IsLoginTemplate.jsx @@ -1,22 +1,17 @@ import { useNavigate } from "react-router-dom"; import { useEffect } from "react"; -import { onAuthStateChanged } from "firebase/auth"; -import { auth } from "../service/auth"; +import { firebaseAuth } from "../service/firebaseConfig"; function IsLoginTemplate(props) { - const navigate = useNavigate(); + const navigate = useNavigate(); - useEffect(() => { - onAuthStateChanged(auth, (user) => { - if (user) { - navigate("/Home"); - } else { - navigate("/Login"); - } - }); - }, [auth]); + useEffect(() => { + if (firebaseAuth.currentUser) { + navigate("/Home"); + } + }, []); - return <>{props.children}; + return <>{props.children}; } export default IsLoginTemplate; diff --git a/src/service/auth.js b/src/service/auth.js index 6f93841..1613b36 100644 --- a/src/service/auth.js +++ b/src/service/auth.js @@ -1,45 +1,21 @@ -import { - GoogleAuthProvider, - getAuth, - signInWithPopup, - signOut, - updateProfile, -} from "firebase/auth"; +import { GoogleAuthProvider, getAuth, signInWithPopup } from "firebase/auth"; import { firebaseAuth } from "./firebaseConfig"; const provider = new GoogleAuthProvider(); -export const auth = firebaseAuth; +const auth = firebaseAuth; export const signInWithGoogle = () => { - signInWithPopup(auth, provider) - .then((result) => { - const credential = GoogleAuthProvider.credentialFromResult(result); - const token = credential.accessToken; - const user = result.user; - }) - .catch((err) => { - const errorCode = err.code; - const errorMessage = err.message; - const email = err.customData.email; - const credential = GoogleAuthProvider.credentialFromError(err); - }); -}; - -export const onSignOut = async () => { - try { - await signOut(auth); - } catch (error) { - console.log(error); - } -}; - -export const setDisplayName = async (displayName) => { - updateProfile(auth.currentUser, { - displayName: displayName, + signInWithPopup(auth, provider) + .then((result) => { + const credential = GoogleAuthProvider.credentialFromResult(result); + const token = credential.accessToken; + const user = result.user; }) - .then(() => {}) - .catch((error) => { - console.log(error); - }); + .catch((err) => { + const errorCode = err.code; + const errorMessage = err.message; + const email = err.customData.email; + const credential = GoogleAuthProvider.credentialFromError(err); + }); };