diff --git a/src/component/EditMyPage.js b/src/component/EditMyPage.js index de84f43..790e4c8 100644 --- a/src/component/EditMyPage.js +++ b/src/component/EditMyPage.js @@ -2,6 +2,7 @@ import "../EditMyPage.css" import React , {useState, useEffect,useCallback} from 'react'; import axios from "axios"; import { RiEdit2Fill } from "react-icons/ri"; +import { FaCrown } from "react-icons/fa"; export default function EditMyPage({location}){ @@ -10,10 +11,29 @@ export default function EditMyPage({location}){ const pw=location.state.pw; const email=location.state.email; const major=location.state.major; + const tel=location.state.tel; + const [boolChangePw,setBoolChangePw]=useState(false); + const [newPw, setNewPw]=useState(pw); const [newEmail, setNewEmail]=useState(email); const [newMajor, setNewMajor]=useState(major); + const [newTel, setNewTel]=useState(tel); + const newUser ={ + id:id, + name: name, + email:newEmail, + major:newMajor, + pw: boolChangePw ? newPw : pw , + tel:newTel + } + + const changePw=useCallback( + (e) => { + setNewPw(e.target.value); + }, + [] + ); const changeEmail=useCallback( (e) => { setNewEmail(e.target.value); @@ -26,24 +46,42 @@ export default function EditMyPage({location}){ }, [] ); + const changeTel=useCallback( + (e) => { + setNewTel(e.target.value); + }, + [] + ); + - const editEmail=(id, {data})=>{ - console.log(data); + const editPw=(id ,name, newPw)=>{ + setBoolChangePw(true); + axios.post('/mypage/changePw',{ + id:id, + name: name, + newPw: newPw + }) + } + + const editEmail=(id, newUser)=>{ axios.post('/mypage/changeEmail',{ id:id, - newEmail:data, + newEmail:newUser, }) - - } - const editMajor=(id, {data})=>{ + const editMajor=(id,newUser )=>{ axios.post('/mypage/changeMajor',{ id:id, - newMajor:data, + newMajor:newUser, + }) + } + const editTel=(id, newUser)=>{ + axios.post('/mypage/changeTel',{ + id:id, + newTel:newUser, }) } - return(
@@ -56,21 +94,26 @@ export default function EditMyPage({location}){
비밀번호
이메일
전공
+
전화번호
{name}
{id}
- - + + +
+
+ +
- - + +
- - + +
diff --git a/src/component/Home.js b/src/component/Home.js index 0b50b96..2a578d7 100644 --- a/src/component/Home.js +++ b/src/component/Home.js @@ -126,9 +126,12 @@ function Home() {
+ + +
{!isLoggedIn ? ( diff --git a/src/component/MyPage.js b/src/component/MyPage.js index b794bb5..c9d78fa 100644 --- a/src/component/MyPage.js +++ b/src/component/MyPage.js @@ -33,6 +33,7 @@ export default function MyPage(){
아이디
이메일
전공
+
전화번호
@@ -40,6 +41,7 @@ export default function MyPage(){
{user.id}
{user.email}
{user.major}
+
{user.tel}
@@ -51,7 +53,8 @@ export default function MyPage(){ id:user.id, pw:user.pw, email:user.email, - major:user.major + major:user.major, + tel: user.tel } }}>