From 38862e5857b3eb437bc2aaecdfbb12bd45c30588 Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Wed, 22 Jan 2025 18:16:03 +0900 Subject: [PATCH 01/16] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 5 +- src/components/login/Button.tsx | 26 +++++++++++ src/components/login/Input.tsx | 73 ++++++++++++++++++++++++++++++ src/components/login/InputItem.tsx | 43 ++++++++++++++++++ src/components/pages/LoginPage.tsx | 68 ++++++++++++++++++++++++++++ 5 files changed, 213 insertions(+), 2 deletions(-) create mode 100644 src/components/login/Button.tsx create mode 100644 src/components/login/Input.tsx create mode 100644 src/components/login/InputItem.tsx create mode 100644 src/components/pages/LoginPage.tsx diff --git a/src/App.tsx b/src/App.tsx index 7e1d97e..494fe01 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,6 +2,7 @@ import { BrowserRouter, Route, Routes } from "react-router-dom"; import HomePage from "./components/pages/Homepage.tsx"; import NavBar from "./components/nav/NavBar.tsx"; import GlobalStyle from "./components/style/GlobalStyle.tsx"; +import LoginPage from "./components/pages/LoginPage.tsx"; function App() { return ( @@ -10,8 +11,8 @@ function App() { - } /> - + } /> + } /> diff --git a/src/components/login/Button.tsx b/src/components/login/Button.tsx new file mode 100644 index 0000000..7862b3e --- /dev/null +++ b/src/components/login/Button.tsx @@ -0,0 +1,26 @@ +/** @jsxImportSource @emotion/react */ +import styled from "@emotion/styled"; +import { useNavigate } from "react-router-dom"; // navigate 훅 사용 + +const ButtonStyle = styled.button` + cursor: pointer; + color: white; + background-color: rgb(0, 0, 128); + font-weight: bold; + font-size: large; + border: none; + border-radius: 10px; + height: 50px; + width: 100%; + margin-top: 30px; +`; + +const Button = () => { + const navigate = useNavigate(); + const handleContinueLogin = () => { + navigate("/home"); // 로그인 후 이동할 경로 + }; + return 로그인; +}; + +export default Button; diff --git a/src/components/login/Input.tsx b/src/components/login/Input.tsx new file mode 100644 index 0000000..c566c8c --- /dev/null +++ b/src/components/login/Input.tsx @@ -0,0 +1,73 @@ +// src/components/login/Input.tsx +/** @jsxImportSource @emotion/react */ +import styled from "@emotion/styled"; +import InputItem from "./InputItem"; +import { useState } from "react"; + +interface InputProps { + id: string; + setId: React.Dispatch>; + pw: string; + setPw: React.Dispatch>; + handlePw?: (e: React.ChangeEvent) => void; +} + +const InputStyle = styled.div` + display: flex; + flex-direction: column; +`; + +const InputWrapStyle = styled.div` + display: flex; + flex-direction: column; + gap: 20px; +`; + +const ErrorMessageStyle = styled.div` + color: #ef0000; + font-size: 12px; +`; + +const Input = ({ id, setId, pw, setPw }: InputProps) => { + const [pwValid, setPwValid] = useState(false); + + const handlePw = (e: React.ChangeEvent) => { + setPw(e.target.value); + const regex = + /^(?=.*[A-Za-z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,}$/; + if (regex.test(pw)) { + setPwValid(true); + } else { + setPwValid(false); + } + }; + + return ( + + + { + setId(e.target.value); + }} + /> + + + + + {!pwValid && pw.length > 0 && ( + 영문, 숫자, 특수문자 포함 8자 이상 입력해주세요. + )} + + + ); +}; + +export default Input; diff --git a/src/components/login/InputItem.tsx b/src/components/login/InputItem.tsx new file mode 100644 index 0000000..db1df74 --- /dev/null +++ b/src/components/login/InputItem.tsx @@ -0,0 +1,43 @@ +// src/components/login/InputItem.tsx +/** @jsxImportSource @emotion/react */ +import styled from "@emotion/styled"; + +interface InputItemProps { + content: string; + type: string; + value: string; + onChange: (e: React.ChangeEvent) => void; +} + +const InputStyle = styled.input` + border-radius: 5px; + width: 100%; + height: 40px; + background-color: #e3e3e3; + border: none; + outline: none; + font-size: 15px; + font-weight: 400; +`; + +const InputItemStyle = styled.div` + display: flex; + border-radius: 8px; + background-color: #e3e3e3; + padding: 5px; +`; + +const InputItem = ({ content, type, value, onChange }: InputItemProps) => { + return ( + + + + ); +}; + +export default InputItem; diff --git a/src/components/pages/LoginPage.tsx b/src/components/pages/LoginPage.tsx new file mode 100644 index 0000000..95165b1 --- /dev/null +++ b/src/components/pages/LoginPage.tsx @@ -0,0 +1,68 @@ +// src/components/login/Main.tsx +/** @jsxImportSource @emotion/react */ +import styled from "@emotion/styled"; +import { useState } from "react"; +import Input from "../login/Input"; +import Button from "../login/Button"; + +const WrapperStyle = styled.div` + display: flex; + flex-direction: column; + gap: 10px; + justify-content: center; + width: 100%; +`; +const MainContainerStyle = styled.div` + display: flex; + flex-direction: column; + gap: 20px; + width: 25%; + height: 60%; + justify-content: center; + align-items: center; + + /* 페이지 전체 화면에서 중앙 정렬 */ + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + h1 { + font-size: 40px; + } + + p { + cursor: pointer; + justify-content: center; + width: auto; + } +`; +const LoginPage = () => { + const [id, setId] = useState(""); + const [pw, setPw] = useState(""); + // const handlePw = (e: React.ChangeEvent) => { + // setPw(e.target.value); + // }; + console.log("로그인 페이지 렌더링"); + return ( + <> + + 로그인 + + + + + + 회원가입 + + + > + ); +}; + +export default LoginPage; From ba75b8f351aadae8766f22aed9bcc45fec8dd247 Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Wed, 22 Jan 2025 20:04:31 +0900 Subject: [PATCH 02/16] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20UI=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 2 ++ src/components/join/Button.tsx | 33 ++++++++++++++++++++ src/components/join/GotoLogin.tsx | 9 ++++++ src/components/join/Input.tsx | 21 +++++++++++++ src/components/join/InputItem.tsx | 22 ++++++++++++++ src/components/pages/JoinPage.tsx | 48 ++++++++++++++++++++++++++++++ src/components/pages/LoginPage.tsx | 1 + 7 files changed, 136 insertions(+) create mode 100644 src/components/join/Button.tsx create mode 100644 src/components/join/GotoLogin.tsx create mode 100644 src/components/join/Input.tsx create mode 100644 src/components/join/InputItem.tsx create mode 100644 src/components/pages/JoinPage.tsx diff --git a/src/App.tsx b/src/App.tsx index 494fe01..74e8365 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,6 +3,7 @@ import HomePage from "./components/pages/Homepage.tsx"; import NavBar from "./components/nav/NavBar.tsx"; import GlobalStyle from "./components/style/GlobalStyle.tsx"; import LoginPage from "./components/pages/LoginPage.tsx"; +import JoinPage from "./components/pages/JoinPage.tsx"; function App() { return ( @@ -11,6 +12,7 @@ function App() { + } /> } /> } /> diff --git a/src/components/join/Button.tsx b/src/components/join/Button.tsx new file mode 100644 index 0000000..55f70f8 --- /dev/null +++ b/src/components/join/Button.tsx @@ -0,0 +1,33 @@ +import styled from "@emotion/styled"; + +const ButtonWrapStyle = styled.div` + cursor: pointer; + width: 100%; + background-color: rgb(0, 0, 128); + border-radius: 10px; + height: 50px; + + border: 3px solid skyblue; + + display: flex; + justify-content: center; + margin-top: 30px; +`; + +const ButtonStyle = styled.button` + cursor: pointer; + color: white; + background-color: rgb(0, 0, 128); + font-weight: bold; + font-size: large; + border: none; +`; + +const Button = () => { + return ( + + 회원가입 + + ); +}; +export default Button; diff --git a/src/components/join/GotoLogin.tsx b/src/components/join/GotoLogin.tsx new file mode 100644 index 0000000..0875bb6 --- /dev/null +++ b/src/components/join/GotoLogin.tsx @@ -0,0 +1,9 @@ +const GotoLogin = () => { + return ( + + 이미 계정이 있으신가요? 로그인 + + ); +}; + +export default GotoLogin; diff --git a/src/components/join/Input.tsx b/src/components/join/Input.tsx new file mode 100644 index 0000000..d2b0c21 --- /dev/null +++ b/src/components/join/Input.tsx @@ -0,0 +1,21 @@ +import InputItem from "./InputItem"; +import styled from "@emotion/styled"; + +const InputWrapStyle = styled.div` + display: flex; + flex-direction: column; + gap: 10px; +`; + +const Input = () => { + return ( + + + + + + + ); +}; + +export default Input; diff --git a/src/components/join/InputItem.tsx b/src/components/join/InputItem.tsx new file mode 100644 index 0000000..2a08451 --- /dev/null +++ b/src/components/join/InputItem.tsx @@ -0,0 +1,22 @@ +import styled from "@emotion/styled"; + +interface InputItemProps { + content: string; +} + +const InputItemStyle = styled.input` + border-radius: 5px; + width: 100%; + height: 45px; + background-color: #e3e3e3; + border: none; +`; + +const InputItem = ({ content }: InputItemProps) => { + return ( + + + + ); +}; +export default InputItem; diff --git a/src/components/pages/JoinPage.tsx b/src/components/pages/JoinPage.tsx new file mode 100644 index 0000000..bedeb3d --- /dev/null +++ b/src/components/pages/JoinPage.tsx @@ -0,0 +1,48 @@ +import Input from "../join/Input"; +import Button from "../join/Button"; +import styled from "@emotion/styled"; +import GotoLogin from "../join/GotoLogin"; + +const JoinContainerStyle = styled.div` + display: flex; + flex-direction: column; + gap: 20px; + width: 25%; + height: 60%; + justify-content: center; + align-items: center; + + /* 페이지 전체 화면에서 중앙 정렬 */ + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + h1 { + font-size: 40px; + } +`; + +const JoinWperStyle = styled.div` + display: flex; + flex-direction: column; + gap: 10px; + justify-content: center; + width: 100%; +`; + +const JoinPage = () => { + return ( + <> + + 회원가입 + + + + + + + > + ); +}; + +export default JoinPage; diff --git a/src/components/pages/LoginPage.tsx b/src/components/pages/LoginPage.tsx index 95165b1..3254b53 100644 --- a/src/components/pages/LoginPage.tsx +++ b/src/components/pages/LoginPage.tsx @@ -10,6 +10,7 @@ const WrapperStyle = styled.div` flex-direction: column; gap: 10px; justify-content: center; + align-items: center; width: 100%; `; const MainContainerStyle = styled.div` From 29c734edec0ef3262b68bf4aa6d117ed0fb4c53d Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Wed, 22 Jan 2025 20:15:22 +0900 Subject: [PATCH 03/16] =?UTF-8?q?fix:=20input=20=ED=81=AC=EA=B8=B0=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/login/Input.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/login/Input.tsx b/src/components/login/Input.tsx index c566c8c..5ced8da 100644 --- a/src/components/login/Input.tsx +++ b/src/components/login/Input.tsx @@ -15,6 +15,7 @@ interface InputProps { const InputStyle = styled.div` display: flex; flex-direction: column; + width: 100%; `; const InputWrapStyle = styled.div` From 75e4e11ed7ebc4c49c28b5033701e6a520df2aa6 Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Thu, 23 Jan 2025 00:33:40 +0900 Subject: [PATCH 04/16] =?UTF-8?q?feat:=20gotologin=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/join/GotoLogin.tsx | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/components/join/GotoLogin.tsx b/src/components/join/GotoLogin.tsx index 0875bb6..6bb1c35 100644 --- a/src/components/join/GotoLogin.tsx +++ b/src/components/join/GotoLogin.tsx @@ -1,7 +1,36 @@ +/** @jsxImportSource @emotion/react */ +import styled from "@emotion/styled"; +import { useNavigate } from "react-router-dom"; + +const GotoLoginContainer = styled.div` + font-size: 16px; + color: gray; + display: flex; + justify-content: center; +`; + +const UnderlinedLink = styled.u` + color: gray; + cursor: pointer; + text-decoration: underline; + justify-content: center; + + &:hover { + color: black; + } +`; + const GotoLogin = () => { + const navigate = useNavigate(); + const handleGotoLogin = () => { + navigate("/login"); // 로그인 후 이동할 경로 + }; return ( - 이미 계정이 있으신가요? 로그인 + + 이미 계정이 있으신가요? + 로그인 + ); }; From 6a769ebac8ccf3ec46ec601d165f73387a56f4cc Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Thu, 23 Jan 2025 00:55:41 +0900 Subject: [PATCH 05/16] =?UTF-8?q?feat:=20gotologin=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 2 +- src/components/login/GotoJoin.tsx | 35 ++++++++++++++++++++++++++++++ src/components/pages/LoginPage.tsx | 5 ++--- 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 src/components/login/GotoJoin.tsx diff --git a/src/App.tsx b/src/App.tsx index 74e8365..b828728 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,7 +12,7 @@ function App() { - } /> + } /> } /> } /> diff --git a/src/components/login/GotoJoin.tsx b/src/components/login/GotoJoin.tsx new file mode 100644 index 0000000..de249c7 --- /dev/null +++ b/src/components/login/GotoJoin.tsx @@ -0,0 +1,35 @@ +/** @jsxImportSource @emotion/react */ +import styled from "@emotion/styled"; +import { useNavigate } from "react-router-dom"; + +const GotoJoinContainer = styled.div` + font-size: 16px; + color: gray; + display: flex; + justify-content: center; +`; + +const UnderlinedLink = styled.u` + color: gray; + cursor: pointer; + text-decoration: underline; + justify-content: center; + + &:hover { + color: black; + } +`; + +const GotoJoin = () => { + const navigate = useNavigate(); + const handleGotoJoin = () => { + navigate("/join"); // 로그인 후 이동할 경로 + }; + return ( + + 회원가입 + + ); +}; + +export default GotoJoin; diff --git a/src/components/pages/LoginPage.tsx b/src/components/pages/LoginPage.tsx index 3254b53..1151e55 100644 --- a/src/components/pages/LoginPage.tsx +++ b/src/components/pages/LoginPage.tsx @@ -4,6 +4,7 @@ import styled from "@emotion/styled"; import { useState } from "react"; import Input from "../login/Input"; import Button from "../login/Button"; +import GotoJoin from "../login/GotoJoin"; const WrapperStyle = styled.div` display: flex; @@ -58,9 +59,7 @@ const LoginPage = () => { /> - - 회원가입 - + > ); From a645ddf661f21813cf0cc08ccbf0315b20e3808c Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Thu, 23 Jan 2025 11:28:15 +0900 Subject: [PATCH 06/16] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/join/Input.tsx | 99 +++++++++++++++++++++++++++++-- src/components/join/InputItem.tsx | 12 +++- src/components/pages/JoinPage.tsx | 16 ++++- 3 files changed, 119 insertions(+), 8 deletions(-) diff --git a/src/components/join/Input.tsx b/src/components/join/Input.tsx index d2b0c21..d98df32 100644 --- a/src/components/join/Input.tsx +++ b/src/components/join/Input.tsx @@ -1,5 +1,17 @@ import InputItem from "./InputItem"; import styled from "@emotion/styled"; +import { useState } from "react"; + +interface InputProps { + newPw: string; + setNewPw: React.Dispatch>; + newId: string; + setNewId: React.Dispatch>; + newAlias: string; + setNewAlias: React.Dispatch>; + checkNewPw: string; + setCheckNewPw: React.Dispatch>; +} const InputWrapStyle = styled.div` display: flex; @@ -7,13 +19,90 @@ const InputWrapStyle = styled.div` gap: 10px; `; -const Input = () => { +const ErrorMessageStyle = styled.div` + color: #ef0000; + font-size: 12px; +`; + +const PwMismatchStyle = styled.div` + color: #ef0000; + font-size: 12px; +`; + +const Input = ({ + newId, + setNewId, + newPw, + setNewPw, + newAlias, + setNewAlias, + checkNewPw, + setCheckNewPw, +}: InputProps) => { + const [newPwValid, setNewPwValid] = useState(false); + + const handleNewPw = (e: React.ChangeEvent) => { + const value = e.target.value; + setNewPw(value); + const regex = + /^(?=.*[A-Za-z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,}$/; + if (regex.test(newPw)) { + setNewPwValid(true); + } else { + setNewPwValid(false); + } + }; + + const handleNewId = (e: React.ChangeEvent) => { + const value = e.target.value; + setNewId(value); + }; + + const handleNewAlias = (e: React.ChangeEvent) => { + const value = e.target.value; + setNewAlias(value); + }; + + const handleCheckNewPw = (e: React.ChangeEvent) => { + const value = e.target.value; + setCheckNewPw(value); + }; + return ( - - - - + + + + + {!newPwValid && newPw.length > 0 && ( + 영문, 숫자, 특수문자 포함 8자 이상 입력해주세요. + )} + + + + + {newPw != checkNewPw && 비밀번호가 일치하지 않습니다.} + ); }; diff --git a/src/components/join/InputItem.tsx b/src/components/join/InputItem.tsx index 2a08451..44187e4 100644 --- a/src/components/join/InputItem.tsx +++ b/src/components/join/InputItem.tsx @@ -2,6 +2,9 @@ import styled from "@emotion/styled"; interface InputItemProps { content: string; + value?: string; + type: string; + onChange?: (e: React.ChangeEvent) => void; } const InputItemStyle = styled.input` @@ -12,10 +15,15 @@ const InputItemStyle = styled.input` border: none; `; -const InputItem = ({ content }: InputItemProps) => { +const InputItem = ({ content, value, onChange, type }: InputItemProps) => { return ( - + ); }; diff --git a/src/components/pages/JoinPage.tsx b/src/components/pages/JoinPage.tsx index bedeb3d..5ee5bed 100644 --- a/src/components/pages/JoinPage.tsx +++ b/src/components/pages/JoinPage.tsx @@ -2,6 +2,7 @@ import Input from "../join/Input"; import Button from "../join/Button"; import styled from "@emotion/styled"; import GotoLogin from "../join/GotoLogin"; +import { useState } from "react"; const JoinContainerStyle = styled.div` display: flex; @@ -31,12 +32,25 @@ const JoinWperStyle = styled.div` `; const JoinPage = () => { + const [newId, setNewId] = useState(""); + const [newPw, setNewPw] = useState(""); + const [checkNewPw, setCheckNewPw] = useState(""); + const [newAlias, setNewAlias] = useState(""); return ( <> 회원가입 - + From 2342b1b695d59fe0e5d26428127a6e54b992377a Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Thu, 23 Jan 2025 13:37:38 +0900 Subject: [PATCH 07/16] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20api=EB=A1=9C=20=EC=97=B0=EA=B2=B0=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/join/Button.tsx | 8 +++----- src/components/join/GotoLogin.tsx | 2 +- src/components/join/Input.tsx | 4 +++- src/components/pages/JoinPage.tsx | 34 ++++++++++++++++++++++++++++++- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/src/components/join/Button.tsx b/src/components/join/Button.tsx index 55f70f8..edff9d2 100644 --- a/src/components/join/Button.tsx +++ b/src/components/join/Button.tsx @@ -7,11 +7,9 @@ const ButtonWrapStyle = styled.div` border-radius: 10px; height: 50px; - border: 3px solid skyblue; - display: flex; justify-content: center; - margin-top: 30px; + margin-top: 15px; `; const ButtonStyle = styled.button` @@ -23,10 +21,10 @@ const ButtonStyle = styled.button` border: none; `; -const Button = () => { +const Button = ({ handleSignup }: { handleSignup: () => void }) => { return ( - 회원가입 + 회원가입 ); }; diff --git a/src/components/join/GotoLogin.tsx b/src/components/join/GotoLogin.tsx index 6bb1c35..322f8af 100644 --- a/src/components/join/GotoLogin.tsx +++ b/src/components/join/GotoLogin.tsx @@ -28,7 +28,7 @@ const GotoLogin = () => { return ( - 이미 계정이 있으신가요? + 이미 계정이 있으신가요? 로그인 diff --git a/src/components/join/Input.tsx b/src/components/join/Input.tsx index d98df32..2d4dff2 100644 --- a/src/components/join/Input.tsx +++ b/src/components/join/Input.tsx @@ -101,7 +101,9 @@ const Input = ({ type="password" /> - {newPw != checkNewPw && 비밀번호가 일치하지 않습니다.} + {newPw != checkNewPw && checkNewPw.length >= 1 && ( + 비밀번호가 일치하지 않습니다. + )} ); diff --git a/src/components/pages/JoinPage.tsx b/src/components/pages/JoinPage.tsx index 5ee5bed..22f5263 100644 --- a/src/components/pages/JoinPage.tsx +++ b/src/components/pages/JoinPage.tsx @@ -36,6 +36,38 @@ const JoinPage = () => { const [newPw, setNewPw] = useState(""); const [checkNewPw, setCheckNewPw] = useState(""); const [newAlias, setNewAlias] = useState(""); + + const handleSignup = async () => { + if (newPw !== checkNewPw) { + alert("비밀번호가 일치하지 않습니다."); + return; + } + const signupData = { + id: newId, + password: newPw, + alias: newAlias, + }; + + try { + const response = await fetch("http://members/join", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(signupData), + }); + + if (response.ok) { + alert("회원가입에 성공했습니다!"); + window.location.href = "/login"; + } else { + const errorData = await response.json(); + alert(`회원가입 실패: ${errorData.message}`); + } + } catch (error) { + console.error("회원가입 요청 중 오류 발생:", error); + alert("회원가입 요청 중 문제가 발생했습니다."); + } + }; + return ( <> @@ -51,7 +83,7 @@ const JoinPage = () => { checkNewPw={checkNewPw} setCheckNewPw={setCheckNewPw} /> - + From 52639b9229ca1614fbd999e6277d2b07ec4184ed Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:21:21 +0900 Subject: [PATCH 08/16] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20API?= =?UTF-8?q?=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/login/Button.tsx | 9 ++---- src/components/login/GotoJoin.tsx | 3 +- src/components/login/Input.tsx | 21 +++--------- src/components/pages/LoginPage.tsx | 52 ++++++++++++++++++++++++++---- 4 files changed, 54 insertions(+), 31 deletions(-) diff --git a/src/components/login/Button.tsx b/src/components/login/Button.tsx index 7862b3e..065fb0a 100644 --- a/src/components/login/Button.tsx +++ b/src/components/login/Button.tsx @@ -1,6 +1,5 @@ /** @jsxImportSource @emotion/react */ import styled from "@emotion/styled"; -import { useNavigate } from "react-router-dom"; // navigate 훅 사용 const ButtonStyle = styled.button` cursor: pointer; @@ -15,12 +14,8 @@ const ButtonStyle = styled.button` margin-top: 30px; `; -const Button = () => { - const navigate = useNavigate(); - const handleContinueLogin = () => { - navigate("/home"); // 로그인 후 이동할 경로 - }; - return 로그인; +const Button = ({ handleLogin }: { handleLogin: () => void }) => { + return 로그인; }; export default Button; diff --git a/src/components/login/GotoJoin.tsx b/src/components/login/GotoJoin.tsx index de249c7..d1368e1 100644 --- a/src/components/login/GotoJoin.tsx +++ b/src/components/login/GotoJoin.tsx @@ -23,10 +23,11 @@ const UnderlinedLink = styled.u` const GotoJoin = () => { const navigate = useNavigate(); const handleGotoJoin = () => { - navigate("/join"); // 로그인 후 이동할 경로 + navigate("/home"); // 로그인 후 이동할 경로 }; return ( + 아직 계정이 없으신가요? 회원가입 ); diff --git a/src/components/login/Input.tsx b/src/components/login/Input.tsx index 5ced8da..b6a0792 100644 --- a/src/components/login/Input.tsx +++ b/src/components/login/Input.tsx @@ -2,14 +2,14 @@ /** @jsxImportSource @emotion/react */ import styled from "@emotion/styled"; import InputItem from "./InputItem"; -import { useState } from "react"; interface InputProps { id: string; setId: React.Dispatch>; pw: string; - setPw: React.Dispatch>; - handlePw?: (e: React.ChangeEvent) => void; + setPw?: React.Dispatch>; + handlePw: (e: React.ChangeEvent) => void; + pwValid: boolean; } const InputStyle = styled.div` @@ -29,20 +29,7 @@ const ErrorMessageStyle = styled.div` font-size: 12px; `; -const Input = ({ id, setId, pw, setPw }: InputProps) => { - const [pwValid, setPwValid] = useState(false); - - const handlePw = (e: React.ChangeEvent) => { - setPw(e.target.value); - const regex = - /^(?=.*[A-Za-z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,}$/; - if (regex.test(pw)) { - setPwValid(true); - } else { - setPwValid(false); - } - }; - +const Input = ({ id, setId, pw, pwValid, handlePw }: InputProps) => { return ( diff --git a/src/components/pages/LoginPage.tsx b/src/components/pages/LoginPage.tsx index 1151e55..01f61f5 100644 --- a/src/components/pages/LoginPage.tsx +++ b/src/components/pages/LoginPage.tsx @@ -38,13 +38,53 @@ const MainContainerStyle = styled.div` width: auto; } `; + const LoginPage = () => { const [id, setId] = useState(""); const [pw, setPw] = useState(""); - // const handlePw = (e: React.ChangeEvent) => { - // setPw(e.target.value); - // }; + const [PwValid, setPwValid] = useState(false); + + const handlePw = (e: React.ChangeEvent) => { + const value = e.target.value; + setPw(value); + const regex = + /^(?=.*[A-Za-z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,}$/; + setPwValid(regex.test(value)); + }; + + const handleLogin = async () => { + if (!PwValid) { + alert( + "비밀번호는 영문, 숫자, 특수문자를 포함하여 8자 이상이어야 합니다." + ); + return; + } + + const loginData = { id, pw }; + + try { + const response = await fetch("http://members/login", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(loginData), + }); + + if (response.ok) { + const data = await response.json(); + console.log("로그인 성공:", data); + window.location.href = "/home"; + } else { + console.error("로그인 실패"); + alert("로그인에 실패했습니다. 아이디 또는 비밀번호를 확인하세요."); + } + } catch (error) { + console.error("네트워크 에러:", error); + alert("서버에 연결할 수 없습니다. 다시 시도해주세요."); + } + }; + console.log("로그인 페이지 렌더링"); + return ( <> @@ -54,10 +94,10 @@ const LoginPage = () => { id={id} setId={setId} pw={pw} - setPw={setPw} - // handlePw={handlePw} + handlePw={handlePw} + pwValid={PwValid} /> - + From 65d994dd0906ecb2617bfa12ddf8fd97cd88fd18 Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Sun, 26 Jan 2025 10:24:56 +0900 Subject: [PATCH 09/16] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=8B=9C,=20=ED=86=A0=ED=81=B0=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/login/Button.tsx | 1 - src/components/login/GotoJoin.tsx | 2 +- src/components/pages/JoinPage.tsx | 26 ++++++++++++++++---------- src/components/pages/LoginPage.tsx | 28 ++++++++++++++++++++-------- 4 files changed, 37 insertions(+), 20 deletions(-) diff --git a/src/components/login/Button.tsx b/src/components/login/Button.tsx index 065fb0a..cb2a6a7 100644 --- a/src/components/login/Button.tsx +++ b/src/components/login/Button.tsx @@ -17,5 +17,4 @@ const ButtonStyle = styled.button` const Button = ({ handleLogin }: { handleLogin: () => void }) => { return 로그인; }; - export default Button; diff --git a/src/components/login/GotoJoin.tsx b/src/components/login/GotoJoin.tsx index d1368e1..9fea33a 100644 --- a/src/components/login/GotoJoin.tsx +++ b/src/components/login/GotoJoin.tsx @@ -23,7 +23,7 @@ const UnderlinedLink = styled.u` const GotoJoin = () => { const navigate = useNavigate(); const handleGotoJoin = () => { - navigate("/home"); // 로그인 후 이동할 경로 + navigate("/join"); // 로그인 후 이동할 경로 }; return ( diff --git a/src/components/pages/JoinPage.tsx b/src/components/pages/JoinPage.tsx index 22f5263..aaf5f79 100644 --- a/src/components/pages/JoinPage.tsx +++ b/src/components/pages/JoinPage.tsx @@ -3,6 +3,7 @@ import Button from "../join/Button"; import styled from "@emotion/styled"; import GotoLogin from "../join/GotoLogin"; import { useState } from "react"; +import { useNavigate } from "react-router-dom"; const JoinContainerStyle = styled.div` display: flex; @@ -38,32 +39,37 @@ const JoinPage = () => { const [newAlias, setNewAlias] = useState(""); const handleSignup = async () => { + const navigate = useNavigate(); if (newPw !== checkNewPw) { alert("비밀번호가 일치하지 않습니다."); return; } const signupData = { - id: newId, + loginId: newId, + username: newAlias, password: newPw, - alias: newAlias, }; try { - const response = await fetch("http://members/join", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify(signupData), - }); - + const response = await fetch( + "http://13.125.208.182:8080/v1/members/join", + { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(signupData), + credentials: "include", + } + ); if (response.ok) { alert("회원가입에 성공했습니다!"); - window.location.href = "/login"; + navigate("/login"); } else { const errorData = await response.json(); alert(`회원가입 실패: ${errorData.message}`); + console.log(`Error status : ${response.status}`); } } catch (error) { - console.error("회원가입 요청 중 오류 발생:", error); + console.log("회원가입 요청 중 오류 발생:", error); alert("회원가입 요청 중 문제가 발생했습니다."); } }; diff --git a/src/components/pages/LoginPage.tsx b/src/components/pages/LoginPage.tsx index 01f61f5..764f691 100644 --- a/src/components/pages/LoginPage.tsx +++ b/src/components/pages/LoginPage.tsx @@ -5,6 +5,7 @@ import { useState } from "react"; import Input from "../login/Input"; import Button from "../login/Button"; import GotoJoin from "../login/GotoJoin"; +import { useNavigate } from "react-router-dom"; const WrapperStyle = styled.div` display: flex; @@ -53,26 +54,37 @@ const LoginPage = () => { }; const handleLogin = async () => { + const navigate = useNavigate(); if (!PwValid) { alert( "비밀번호는 영문, 숫자, 특수문자를 포함하여 8자 이상이어야 합니다." ); return; } - - const loginData = { id, pw }; + const loginId = id; + const password = pw; + const loginData = { loginId, password }; try { - const response = await fetch("http://members/login", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify(loginData), - }); + const response = await fetch( + "http://13.125.208.182:8080/v1/members/login", + { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(loginData), + } + ); if (response.ok) { const data = await response.json(); console.log("로그인 성공:", data); - window.location.href = "/home"; + if (data.accessToken) { + sessionStorage.setItem("accessToken", data.accessToken); + console.log(`Token 저장 : ${data.accessToken}`); + navigate("/home"); + } else { + console.error("서버로부터 AccessToken을 발급받지 못했습니다."); + } } else { console.error("로그인 실패"); alert("로그인에 실패했습니다. 아이디 또는 비밀번호를 확인하세요."); From 42e449a20840378c1a05d6b3d132043095329cb2 Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Sun, 26 Jan 2025 15:02:29 +0900 Subject: [PATCH 10/16] =?UTF-8?q?fix:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=84=98=EC=96=B4=EA=B0=80=EB=8A=94=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 2 -- src/components/login/Button.tsx | 9 ++++++++- src/components/pages/LoginPage.tsx | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index cf68ca0..b828728 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -4,8 +4,6 @@ import NavBar from "./components/nav/NavBar.tsx"; import GlobalStyle from "./components/style/GlobalStyle.tsx"; import LoginPage from "./components/pages/LoginPage.tsx"; import JoinPage from "./components/pages/JoinPage.tsx"; -import LoginPage from "./components/pages/LoginPage.tsx"; -import JoinPage from "./components/pages/JoinPage.tsx"; function App() { return ( diff --git a/src/components/login/Button.tsx b/src/components/login/Button.tsx index cb2a6a7..d8aca06 100644 --- a/src/components/login/Button.tsx +++ b/src/components/login/Button.tsx @@ -1,5 +1,6 @@ /** @jsxImportSource @emotion/react */ import styled from "@emotion/styled"; +import { useNavigate } from "react-router-dom"; const ButtonStyle = styled.button` cursor: pointer; @@ -15,6 +16,12 @@ const ButtonStyle = styled.button` `; const Button = ({ handleLogin }: { handleLogin: () => void }) => { - return 로그인; + const navigate = useNavigate(); + + const onClick = () => { + handleLogin(); + navigate("/home"); // handleLogin 실행 후 네비게이트 + }; + return 로그인; }; export default Button; diff --git a/src/components/pages/LoginPage.tsx b/src/components/pages/LoginPage.tsx index 764f691..e47ddfa 100644 --- a/src/components/pages/LoginPage.tsx +++ b/src/components/pages/LoginPage.tsx @@ -44,6 +44,7 @@ const LoginPage = () => { const [id, setId] = useState(""); const [pw, setPw] = useState(""); const [PwValid, setPwValid] = useState(false); + const navigate = useNavigate(); const handlePw = (e: React.ChangeEvent) => { const value = e.target.value; @@ -54,7 +55,6 @@ const LoginPage = () => { }; const handleLogin = async () => { - const navigate = useNavigate(); if (!PwValid) { alert( "비밀번호는 영문, 숫자, 특수문자를 포함하여 8자 이상이어야 합니다." @@ -67,7 +67,7 @@ const LoginPage = () => { try { const response = await fetch( - "http://13.125.208.182:8080/v1/members/login", + "http://15.164.98.149:8080/v1/members/login", { method: "POST", headers: { "Content-Type": "application/json" }, From 0a07179c26b1e0ef23bfd227184a1c32512cf4de Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Sun, 26 Jan 2025 15:41:30 +0900 Subject: [PATCH 11/16] =?UTF-8?q?refactor:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8?= =?UTF-8?q?=20=ED=95=A8=EC=88=98=20=EB=A6=AC=ED=8E=99=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/pages/LoginPage.tsx | 46 ++---------------------------- src/services/handleLogin.ts | 42 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 44 deletions(-) create mode 100644 src/services/handleLogin.ts diff --git a/src/components/pages/LoginPage.tsx b/src/components/pages/LoginPage.tsx index e47ddfa..08f50cf 100644 --- a/src/components/pages/LoginPage.tsx +++ b/src/components/pages/LoginPage.tsx @@ -6,6 +6,7 @@ import Input from "../login/Input"; import Button from "../login/Button"; import GotoJoin from "../login/GotoJoin"; import { useNavigate } from "react-router-dom"; +import { handleLogin } from "../../services/handleLogin"; const WrapperStyle = styled.div` display: flex; @@ -54,49 +55,6 @@ const LoginPage = () => { setPwValid(regex.test(value)); }; - const handleLogin = async () => { - if (!PwValid) { - alert( - "비밀번호는 영문, 숫자, 특수문자를 포함하여 8자 이상이어야 합니다." - ); - return; - } - const loginId = id; - const password = pw; - const loginData = { loginId, password }; - - try { - const response = await fetch( - "http://15.164.98.149:8080/v1/members/login", - { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify(loginData), - } - ); - - if (response.ok) { - const data = await response.json(); - console.log("로그인 성공:", data); - if (data.accessToken) { - sessionStorage.setItem("accessToken", data.accessToken); - console.log(`Token 저장 : ${data.accessToken}`); - navigate("/home"); - } else { - console.error("서버로부터 AccessToken을 발급받지 못했습니다."); - } - } else { - console.error("로그인 실패"); - alert("로그인에 실패했습니다. 아이디 또는 비밀번호를 확인하세요."); - } - } catch (error) { - console.error("네트워크 에러:", error); - alert("서버에 연결할 수 없습니다. 다시 시도해주세요."); - } - }; - - console.log("로그인 페이지 렌더링"); - return ( <> @@ -109,7 +67,7 @@ const LoginPage = () => { handlePw={handlePw} pwValid={PwValid} /> - + handleLogin(id, pw, navigate)} /> diff --git a/src/services/handleLogin.ts b/src/services/handleLogin.ts new file mode 100644 index 0000000..cc26ca3 --- /dev/null +++ b/src/services/handleLogin.ts @@ -0,0 +1,42 @@ +export const handleLogin = async ( + id: string, + pw: string, + navigate: (path: string) => void +) => { + const regex = + /^(?=.*[A-Za-z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,}$/; + + if (!regex.test(pw)) { + alert("비밀번호는 영문, 숫자, 특수문자를 포함하여 8자 이상이어야 합니다."); + return; + } + + const loginData = { loginId: id, password: pw }; + + try { + const response = await fetch("http://15.164.98.149:8080/v1/members/login", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(loginData), + }); + + if (response.ok) { + const data = await response.json(); + console.log("로그인 성공:", data); + + if (data.accessToken) { + sessionStorage.setItem("accessToken", data.accessToken); + console.log(`Token 저장 : ${data.accessToken}`); + navigate("/home"); + } else { + console.error("서버로부터 AccessToken을 발급받지 못했습니다."); + } + } else { + console.error("로그인 실패"); + alert("로그인에 실패했습니다. 아이디 또는 비밀번호를 확인하세요."); + } + } catch (error) { + console.error("네트워크 에러:", error); + alert("서버에 연결할 수 없습니다. 다시 시도해주세요."); + } +}; From 591bdedb47c8066269adbe3f27fc0ea85bdebf2d Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Sun, 26 Jan 2025 16:06:42 +0900 Subject: [PATCH 12/16] =?UTF-8?q?refactor:=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=ED=95=A8=EC=88=98=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/pages/JoinPage.tsx | 44 +++++-------------------------- src/services/handleSignup.ts | 37 ++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 37 deletions(-) create mode 100644 src/services/handleSignup.ts diff --git a/src/components/pages/JoinPage.tsx b/src/components/pages/JoinPage.tsx index aaf5f79..4765457 100644 --- a/src/components/pages/JoinPage.tsx +++ b/src/components/pages/JoinPage.tsx @@ -4,6 +4,7 @@ import styled from "@emotion/styled"; import GotoLogin from "../join/GotoLogin"; import { useState } from "react"; import { useNavigate } from "react-router-dom"; +import { handleSignup } from "../../services/handleSignup"; const JoinContainerStyle = styled.div` display: flex; @@ -37,42 +38,7 @@ const JoinPage = () => { const [newPw, setNewPw] = useState(""); const [checkNewPw, setCheckNewPw] = useState(""); const [newAlias, setNewAlias] = useState(""); - - const handleSignup = async () => { - const navigate = useNavigate(); - if (newPw !== checkNewPw) { - alert("비밀번호가 일치하지 않습니다."); - return; - } - const signupData = { - loginId: newId, - username: newAlias, - password: newPw, - }; - - try { - const response = await fetch( - "http://13.125.208.182:8080/v1/members/join", - { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify(signupData), - credentials: "include", - } - ); - if (response.ok) { - alert("회원가입에 성공했습니다!"); - navigate("/login"); - } else { - const errorData = await response.json(); - alert(`회원가입 실패: ${errorData.message}`); - console.log(`Error status : ${response.status}`); - } - } catch (error) { - console.log("회원가입 요청 중 오류 발생:", error); - alert("회원가입 요청 중 문제가 발생했습니다."); - } - }; + const navigator = useNavigate(); return ( <> @@ -89,7 +55,11 @@ const JoinPage = () => { checkNewPw={checkNewPw} setCheckNewPw={setCheckNewPw} /> - + + handleSignup(newId, newAlias, newPw, checkNewPw, navigator) + } + /> diff --git a/src/services/handleSignup.ts b/src/services/handleSignup.ts new file mode 100644 index 0000000..84ebbba --- /dev/null +++ b/src/services/handleSignup.ts @@ -0,0 +1,37 @@ +export const handleSignup = async ( + newId: string, + newAlias: string, + newPw: string, + checkNewPw: string, + navigate: (path: string) => void +) => { + if (newPw !== checkNewPw) { + alert("비밀번호가 일치하지 않습니다."); + return; + } + const signupData = { + loginId: newId, + username: newAlias, + password: newPw, + }; + + try { + const response = await fetch("http://15.164.98.149:8080/v1/members/join", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(signupData), + credentials: "include", + }); + if (response.ok) { + alert("회원가입에 성공했습니다!"); + navigate("/login"); + } else { + const errorData = await response.json(); + alert(`회원가입 실패: ${errorData.message}`); + console.log(`Error status : ${response.status}`); + } + } catch (error) { + console.log("회원가입 요청 중 오류 발생:", error); + alert("회원가입 요청 중 문제가 발생했습니다."); + } +}; From 0b75ef2f6c565be28521676396c474da26a8904f Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Fri, 31 Jan 2025 17:45:12 +0900 Subject: [PATCH 13/16] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9B=90=20=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EC=A1=B0=EA=B1=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/handleSignup.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/services/handleSignup.ts b/src/services/handleSignup.ts index 84ebbba..54cd533 100644 --- a/src/services/handleSignup.ts +++ b/src/services/handleSignup.ts @@ -5,7 +5,19 @@ export const handleSignup = async ( checkNewPw: string, navigate: (path: string) => void ) => { - if (newPw !== checkNewPw) { + if (newAlias.length == 0) { + alert("별명 입력해주세요."); + return; + } + if (newId.length == 0) { + alert("아이디를 입력해주세요."); + return; + } + if (newPw.length == 0) { + alert("비밀번호를 입력해주세요."); + return; + } + if (newPw !== checkNewPw && checkNewPw.length == 0) { alert("비밀번호가 일치하지 않습니다."); return; } @@ -16,7 +28,7 @@ export const handleSignup = async ( }; try { - const response = await fetch("http://15.164.98.149:8080/v1/members/join", { + const response = await fetch("http://43.201.23.0:8080/v1/members/join", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(signupData), From 20242bc1a669f446f880d624197757d4ff098fa8 Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:21:21 +0900 Subject: [PATCH 14/16] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20API?= =?UTF-8?q?=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/login/GotoJoin.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/login/GotoJoin.tsx b/src/components/login/GotoJoin.tsx index 9fea33a..d1368e1 100644 --- a/src/components/login/GotoJoin.tsx +++ b/src/components/login/GotoJoin.tsx @@ -23,7 +23,7 @@ const UnderlinedLink = styled.u` const GotoJoin = () => { const navigate = useNavigate(); const handleGotoJoin = () => { - navigate("/join"); // 로그인 후 이동할 경로 + navigate("/home"); // 로그인 후 이동할 경로 }; return ( From d4615e4a7811ef2d9d403a4594584cab851490ad Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Sun, 26 Jan 2025 10:24:56 +0900 Subject: [PATCH 15/16] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=8B=9C,=20=ED=86=A0=ED=81=B0=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/login/GotoJoin.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/login/GotoJoin.tsx b/src/components/login/GotoJoin.tsx index d1368e1..9fea33a 100644 --- a/src/components/login/GotoJoin.tsx +++ b/src/components/login/GotoJoin.tsx @@ -23,7 +23,7 @@ const UnderlinedLink = styled.u` const GotoJoin = () => { const navigate = useNavigate(); const handleGotoJoin = () => { - navigate("/home"); // 로그인 후 이동할 경로 + navigate("/join"); // 로그인 후 이동할 경로 }; return ( From cdaec433df769a79fbe8a1ce7e0be388b068782e Mon Sep 17 00:00:00 2001 From: shinwokkang <120699742+shinwokkang@users.noreply.github.com> Date: Sat, 1 Feb 2025 17:45:10 +0900 Subject: [PATCH 16/16] =?UTF-8?q?feat:=20refreshtoken=20=EB=B0=9B=EB=8A=94?= =?UTF-8?q?=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/handleLogin.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/handleLogin.ts b/src/services/handleLogin.ts index cc26ca3..ff461a8 100644 --- a/src/services/handleLogin.ts +++ b/src/services/handleLogin.ts @@ -24,12 +24,14 @@ export const handleLogin = async ( const data = await response.json(); console.log("로그인 성공:", data); - if (data.accessToken) { + if (data.accessToken && data.refreshToken) { sessionStorage.setItem("accessToken", data.accessToken); + sessionStorage.setItem("refreshToken", data.refreshToken); console.log(`Token 저장 : ${data.accessToken}`); + console.log(`Token 저장 : ${data.refreshToken}`); navigate("/home"); } else { - console.error("서버로부터 AccessToken을 발급받지 못했습니다."); + console.error("서버로부터 토큰을 발급받지 못했습니다."); } } else { console.error("로그인 실패");
회원가입