-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Feature/#4 isLoginTemplate 완성, 로그아웃, 닉네임 설정 함수 구현"
- Loading branch information
1 parent
1605bfb
commit 38cf399
Showing
5 changed files
with
138 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
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"; | ||
import SignUpProvider from "../components/provider/SignUpPovider"; | ||
import BackHeader from "../components/common/header/BackHeader"; | ||
|
||
export default function CollectPersonalData() { | ||
return ( | ||
<> | ||
<SignUpProvider> | ||
<BackHeader /> | ||
<Section> | ||
<HeaderBox> | ||
<span>서비스 이용을 위해</span> | ||
<span>{"약관 동의를 해주세요 :)"}</span> | ||
</HeaderBox> | ||
<Button text={"agree"} /> | ||
<TermsBox /> | ||
<Button text={"next"} /> | ||
</Section> | ||
</SignUpProvider> | ||
</> | ||
); | ||
return ( | ||
<> | ||
<SignUpProvider> | ||
<BackHeader /> | ||
<Section> | ||
<HeaderBox> | ||
<span>서비스 이용을 위해</span> | ||
<span>{"약관 동의를 해주세요 :)"}</span> | ||
</HeaderBox> | ||
<Button text={"agree"} /> | ||
<TermsBox /> | ||
<Button text={"next"} /> | ||
</Section> | ||
</SignUpProvider> | ||
</> | ||
); | ||
} | ||
|
||
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; */ | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
}; |