From 5f25610a7067edd2892f29e821e3d84eca82f369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EA=B0=80=EC=98=81?= Date: Mon, 1 Feb 2021 11:32:58 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A7=84=EC=A7=9C=20=EB=81=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/Components/EnterRoom.js | 23 +++++++++++++---------- client/src/Pages/LogInPage.js | 9 ++++----- client/src/Pages/SignUpPage.js | 12 ++++++------ client/src/utils/auth.js | 3 +-- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/client/src/Components/EnterRoom.js b/client/src/Components/EnterRoom.js index 5f98925..f84d553 100644 --- a/client/src/Components/EnterRoom.js +++ b/client/src/Components/EnterRoom.js @@ -13,17 +13,17 @@ function EnterRoom(props) { async function recordEntryLog() { const leaveInfo = { userId: userId, roomCode: enterCode, leaveTime: realTime } try { - const check = await axios.get('/room/entrylog', { params: leaveInfo }) - if (check.data) { //있으면 put으로 - await axios.put('/room/entrylog', leaveInfo) - } else { //없으면 post - await axios.post('/room/entrylog', leaveInfo) - } + const check = await axios.get('/room/entrylog', { params: leaveInfo }) + if (check.data) { //있으면 put으로 + await axios.put('/room/entrylog', leaveInfo) + } else { //없으면 post + await axios.post('/room/entrylog', leaveInfo) + } } catch (error) { - catchErrors(error, setError) + catchErrors(error, setError) } - - } + + } function handleChange(event) { const { name, value } = event.target @@ -57,6 +57,9 @@ function EnterRoom(props) { 참여 코드로 채팅 참가 + {error && + {error} + }
@@ -67,7 +70,7 @@ function EnterRoom(props) { - +
diff --git a/client/src/Pages/LogInPage.js b/client/src/Pages/LogInPage.js index b5ab0f1..1304e08 100644 --- a/client/src/Pages/LogInPage.js +++ b/client/src/Pages/LogInPage.js @@ -54,9 +54,9 @@ function LogIn() { return ( <> -
- -
+ +
+

로그인

이메일 @@ -85,7 +85,6 @@ function LogIn() { 필수 정보입니다! 비밀번호를 입력해주세요! -
- +
); diff --git a/client/src/Pages/SignUpPage.js b/client/src/Pages/SignUpPage.js index b368da0..9c00185 100644 --- a/client/src/Pages/SignUpPage.js +++ b/client/src/Pages/SignUpPage.js @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import axios from 'axios' -import { Button, Form, Container, Alert, Spinner} from 'react-bootstrap'; +import { Button, Form, Container, Alert, Spinner } from 'react-bootstrap'; import catchErrors from '../utils/catchErrors'; import { Redirect } from 'react-router-dom'; import Menu from '../Components/Menu'; @@ -17,7 +17,7 @@ function SingUp() { const [user, setUser] = useState(INIT_USER) const [error, setError] = useState('') const [disabled, setDisabled] = useState(true) - const [success, setSuccess] = useState(false) + const [success, setSuccess] = useState(false) const [loading, setLoading] = useState(false) useEffect(() => { @@ -54,9 +54,9 @@ function SingUp() { return ( <> -
- -
+ +
+

회원가입

@@ -129,7 +129,7 @@ function SingUp() { {error} }
- +
) diff --git a/client/src/utils/auth.js b/client/src/utils/auth.js index 8caacf7..9797c66 100644 --- a/client/src/utils/auth.js +++ b/client/src/utils/auth.js @@ -7,10 +7,9 @@ export function handleLogin(data) { } export async function handleLogout() { + alert('로그아웃 되었습니다') sessionStorage.clear(); await axios.get('/auth/logout') - //login페이지로 이동 - // window.location.href='/login' } export function isAuthenticated() { -- GitLab