diff --git a/src/.App.js.swo b/src/.App.js.swo
deleted file mode 100644
index 4df6e14..0000000
Binary files a/src/.App.js.swo and /dev/null differ
diff --git a/src/App.js b/src/App.js
index dabe6cc..eb86eec 100644
--- a/src/App.js
+++ b/src/App.js
@@ -27,12 +27,11 @@ export default function App() {
//로그인 상태 관리하기--------------------------------
useEffect(() => {
-
//refreshTokenRequest()
- if(accessToken.accessToken!==null){
- history.push('/Waiting')
- }
- },[]);
+ if (accessToken.accessToken !== null) {
+ history.push('/Waiting');
+ }
+ }, []);
const loginHandler = (data) => {
issueAccessToken(data.data.accessToken);
@@ -47,10 +46,8 @@ export default function App() {
const hendleLogout = () => {
axios
- .get(
- 'http://localhost:4000/user/logout',
- {withCredentials: true}
- ).then((res) => {})
+ .get('http://localhost:4000/user/logout', { withCredentials: true })
+ .then((res) => {});
setUserInfo({
id: null,
nickname: null,
@@ -75,8 +72,16 @@ export default function App() {
withCredentials: true,
})
.then((res) => {
+<<<<<<< HEAD
+=======
const { nickname, email, profile_image, comment, id } = res.data.data;
+>>>>>>> a5771eaba281de9abd8e0bf97642c16df821de90
// !
+ return res.data.data;
+ })
+ .then((data) => {
+ console.log('여기야야야야양', data);
+ const { nickname, email, profile_image, comment, id } = data;
setUserInfo({
id: id,
nickname: nickname,
@@ -87,6 +92,12 @@ export default function App() {
});
};
+ useEffect(() => {
+ return () => {
+ localStorage.setItem('userInfo', JSON.stringify(userInfo));
+ };
+ }, [userInfo]);
+
const refreshTokenRequest = () => {
// ! 일정 주기로 함수 계속 보냄
axios
@@ -94,18 +105,31 @@ export default function App() {
withCredentials: true,
})
.then((res) => {
+ if (res.data.message !== 'ok') {
+ }
+ const {
+ nickname,
+ email,
+ profile_image,
+ id,
+ comment,
+ } = res.data.data.userInfo;
+<<<<<<< HEAD
+ setAccessToken({ accessToken: res.data.data.accessToken });
+=======
if (res.data.message !== 'ok') {}
const { nickname, email, profile_image, id,comment } = res.data.data.userInfo;
console.log(res.data.data.accessToken)
setAccessToken({accessToken:res.data.data.accessToken})
+>>>>>>> a5771eaba281de9abd8e0bf97642c16df821de90
setUserInfo({
- id : id,
+ id: id,
nickname: nickname,
email: email,
- comment:comment,
+ comment: comment,
profile_image: profile_image,
});
});
@@ -129,12 +153,21 @@ export default function App() {
withCredentials: true,
}
);
+<<<<<<< HEAD
+
+=======
+>>>>>>> a5771eaba281de9abd8e0bf97642c16df821de90
issueAccessToken(resp.data.accessToken);
};
//구글 로그인 코드 받기--------------------------------
useEffect(() => {
const url = new URL(window.location.href);
const authorizationCode = url.searchParams.get('code');
+<<<<<<< HEAD
+
+ console.log('userInfo:', userInfo);
+=======
+>>>>>>> a5771eaba281de9abd8e0bf97642c16df821de90
if (authorizationCode) {
getAccessToken(authorizationCode);
}
diff --git a/src/GamePages/InGame.js b/src/GamePages/InGame.js
index fe6f3ab..daca810 100644
--- a/src/GamePages/InGame.js
+++ b/src/GamePages/InGame.js
@@ -24,6 +24,7 @@ export default function InGame({ accessToken, isLogIn, loginCheck, userInfo }) {
const [isPresenter, setIsPresenter] = useState(false);
const [winner, setWinner] = useState([]);
const [userlist, setUserlist] = useState([]);
+ const [inputPresenter, setInputPresenter] = useState(false);
//뒤로가기 버튼 방지
const [locationKeys, setLocationKeys] = useState([]);
@@ -116,7 +117,26 @@ export default function InGame({ accessToken, isLogIn, loginCheck, userInfo }) {
socket.emit('set answer', { answer });
};
+ const endGame = () => {
+ setResultPopup(true);
+ setInputPresenter(false);
+ };
+
//! --------------------------method--------------------------
+ useEffect(() => {
+ const localUserInfo = JSON.parse(localStorage.getItem('userInfo'));
+ console.log('정답', localUserInfo.nickname);
+ console.log('출제자', presenter, presenter.nickname);
+
+ if (presenter.nickname === localUserInfo.nickname) {
+ setInputPresenter(true);
+ console.log('너가출제자123213', localUserInfo.nickname);
+ }
+ });
+
+ useEffect(() => {
+ console.log('inputPresenter:내가발표자');
+ }, [inputPresenter]);
@@ -153,7 +173,6 @@ export default function InGame({ accessToken, isLogIn, loginCheck, userInfo }) {
socket.on('renew userlist', (list) => {
- console.log('d우ㅠ저소ㅓ켓');
setUserlist([...list]);
});
}, []);
@@ -203,7 +222,12 @@ export default function InGame({ accessToken, isLogIn, loginCheck, userInfo }) {
{resultPopup ?