Skip to content

Commit

Permalink
Change router my to mypage
Browse files Browse the repository at this point in the history
  • Loading branch information
sehee0207 committed Feb 19, 2024
1 parent b646200 commit f51b96a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Router = () => {
<Route path="/reportlist" element={<Reportlistpage />} />
<Route path="/report/:id" element={<Reportdetailpage />} />
<Route path="/reportwrite" element={<Reportwritepage />} />
<Route path="/my" element={<Mypage />} />
<Route path="/mypage" element={<Mypage />} />
<Route path="/changemy" element={<Changemypage />} />
{/* <Route path="signup" element={<Signup />} /> */}
</Routes>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Header = () => {
</div>
</Link>

<Link to="/my">
<Link to="/mypage">
<div className="my">
<FontAwesomeIcon icon={faUser} /> 마이페이지
</div>
Expand Down
23 changes: 14 additions & 9 deletions src/pages/Mypage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import styled from 'styled-components';
import Button from '../components/Button';
import { useNavigate } from 'react-router-dom';
import Header from '../components/Header';
import { useEffect } from 'react';
import { useEffect, useState } from 'react';
import axios from 'axios';

const ChangemypageStyle = styled.div`
Expand Down Expand Up @@ -70,21 +70,28 @@ const PhonedivStyle = styled.div`

const My = () => {
const navigate = useNavigate();
const [data, setData]= useState([]);

Check failure on line 73 in src/pages/Mypage.tsx

View workflow job for this annotation

GitHub Actions / build

'data' is declared but its value is never read.

const onChangemy = () => {
navigate("/changemy")
}

useEffect(() => {
axios.post('http://localhost:8080/api/mypage')
const instance = axios.create({
baseURL: 'http://localhost:8080', // 여기에 실제 서버 주소를 입력하세요
withCredentials: true
});

instance.post('/api/mypage')
.then(response => {
console.log(response.data);
//navigate("/main") // 회원가입 후 페이지 이동
setData(response.data)
// 응답을 받아서 처리하는 코드를 여기에 작성하세요.
})
.catch(error => {
console.error('Error:', error);
// 에러를 처리하는 코드를 여기에 작성하세요.
});
})
}, []);

return(
<div className="mypage">
Expand All @@ -96,14 +103,12 @@ const My = () => {
<NamedivStyle>
<H5Style>이름</H5Style>
<InputStyle/>
{/* value={data.userId} */}
</NamedivStyle>

<IDdivStyle>
<H5Style>아이디</H5Style>
<InputButtonStyle>
<InputStyle/>
흠냐
</InputButtonStyle>
<InputStyle/>
</IDdivStyle>

<PwdivStyle>
Expand Down

0 comments on commit f51b96a

Please sign in to comment.