Skip to content

Commit

Permalink
Merge pull request #306 from catchroom/feature/#299
Browse files Browse the repository at this point in the history
🐛 fix: 마이페이지 판매내역 상태 변경
  • Loading branch information
minseokiim authored Jan 28, 2024
2 parents 267434e + c2189e0 commit 196d430
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 93 deletions.
20 changes: 1 addition & 19 deletions api/mypage/api.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
import { apiClient } from '../user/apiClient';
// 노션의 api 명세서 번호 기준으로 표시
//import nookies from 'nookies';

//6. 로그아웃
export const logout = async () => {
const res = await apiClient.post('/v1/mypage/logout');
return res.data;
};

// export const logout = async () => {
// console.log(accessToken);
// const res = await fetch(
// `${process.env.NEXT_PUBLIC_SERVER_URL}/v1/mypage/logout`,
// {
// method: 'POST',
// headers: {
// 'Content-Type': 'application/json',
// Authorization: `Bearer ${accessToken}`,
// },
// },
// );
// const data = await res.json();
// return data;
// };

// 7. 닉네임 변경
export const editProfile = async (nickname: string) => {
const res = await apiClient.put(
Expand Down Expand Up @@ -154,7 +136,7 @@ export const editReview = async (
return res.data;
};

//28. 리뷰에서 필요한 정보 조회 (숙소 이름, 이미지, 가격)
//28. 리뷰에서 필요한 정보 조회
export const getRoomInfo = async (id: number) => {
const res = await apiClient.get(`/v1/product?id=${id}`);
return res.data;
Expand Down
43 changes: 0 additions & 43 deletions api/mypage/testApi.ts

This file was deleted.

27 changes: 1 addition & 26 deletions api/user/api.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import nookies from 'nookies';
import axios from 'axios';

// 노션의 api 명세서 번호 기준으로 표시

//1. 회원가입
export const signUp = async (
email: string,
Expand Down Expand Up @@ -63,30 +61,7 @@ export const emailCheck = async (email: string) => {
return data;
};

// 6. 액세스 토큰 재발급 -> apiClient 사용할거면 필요 x, 일단 테스트용
// export const getNewToken = async () => {
// const refreshToken = nookies.get(null)['refreshToken'];

// const res = await fetch(
// `${process.env.NEXT_PUBLIC_SERVER_URL}/v1/user/accesstoken`,
// {
// method: 'POST',
// headers: {
// 'Content-Type': 'application/json',
// Authorization: `Bearer ${refreshToken}`,
// },
// },
// );

// const data = await res.json();
// if (data.accessToken) {
// nookies.set(null, 'accessToken', data.accessToken, {
// path: '/',
// });
// }
// return data;
// };

// 6. 액세스 토큰 재발급
export const getNewToken = async () => {
const refreshToken = nookies.get(null)['refreshToken'];

Expand Down
1 change: 0 additions & 1 deletion api/user/apiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ apiClient.interceptors.response.use(

originalRequest.headers['Authorization'] = `Bearer ${accessToken}`;
const response = await apiClient.request(originalRequest);
//헤더에 담긴지 확인

nookies.set(null, 'accessToken', accessToken, {
path: '/',
Expand Down
4 changes: 2 additions & 2 deletions components/mypage/items/sellingItems/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ const MItem = ({ item }: { item: MypageSellingType }) => {
case 'EXPIRED':
return (
<>
<p>{getSellState(dealState)}</p>
<p>게시 기한 만료</p>
<ReEnrollButton dealState={dealState} fn={handleEditDate} />
</>
);
case 'DONEDEAL':
return <p>판매일 : {getDotDate(item.endDate, true, true, true)}</p>;
case 'UNSOLD':
case 'UNABLESELL':
return <p>{getSellState(dealState)}</p>;
return <p>체크인 만료</p>;
default:
return <p>게시만료일 ~ {getDotDate(item.endDate, true, true, true)}</p>;
}
Expand Down
4 changes: 2 additions & 2 deletions utils/mypage-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export const noMask = (value: string) => {
export const getSellState = (state: string) => {
switch (state) {
case 'EXPIRED':
return '게시 기한 만료';
return '기한 만료';
case 'UNSOLD':
return '체크인 만료';
return '판매 불가';
case 'UNABLESELL':
return '판매 불가';
case 'DONEDEAL':
Expand Down

0 comments on commit 196d430

Please sign in to comment.