-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: review, travel story의 hard coding data를 msw response 값으로 변경
- Loading branch information
Showing
14 changed files
with
258 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
export interface IResponseTravelStory { | ||
pageInfo: { | ||
page: number; | ||
hasNext: number; | ||
hasPrevious: number; | ||
totalElements: number; | ||
totalPages: number; | ||
}; | ||
data: ITravelStory[]; | ||
} | ||
|
||
export interface ITravelStory { | ||
id: number; | ||
isLike: boolean; | ||
likeCount: number; | ||
commentCount: number; | ||
imageSrc: string; | ||
title: string; | ||
tagList: string[]; | ||
userName: string; | ||
userImageSrc: string; | ||
} | ||
|
||
export interface IResponseReview { | ||
pageInfo: { | ||
page: number; | ||
hasNext: number; | ||
hasPrevious: number; | ||
totalElements: number; | ||
totalPages: number; | ||
}; | ||
data: IReview[]; | ||
} | ||
|
||
export interface IReview { | ||
id: number; | ||
score: number; | ||
commentCount: number; | ||
imageSrc: string; | ||
title: string; | ||
description: string; | ||
userName: string; | ||
userImageSrc: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,5 @@ | ||
import { HttpResponse, http } from "msw"; | ||
import { getPlaces } from "./handlers/place"; | ||
import { getReviews } from "./handlers/review"; | ||
import { getTravelStories } from "./handlers/travelStory"; | ||
|
||
import { IResponsePlace } from "@/lib/types/place"; | ||
|
||
export const handlers = [ | ||
http.get<never, never, IResponsePlace>( | ||
"http://jandp-travel.kro.kr/place", | ||
() => { | ||
return HttpResponse.json({ | ||
pageInfo: { | ||
page: 1, | ||
hasNext: 1, | ||
hasPrevious: 0, | ||
totalElements: 2, | ||
totalPages: 1, | ||
}, | ||
data: [ | ||
{ | ||
id: 1, | ||
placeId: "hdaasdasdasdasas", | ||
name: "서울", | ||
subName: "서울", | ||
}, | ||
{ | ||
id: 2, | ||
placeId: "asdasfasfasfas", | ||
name: "대전", | ||
subName: "대전", | ||
}, | ||
], | ||
}); | ||
} | ||
), | ||
]; | ||
export const handlers = [getPlaces, getTravelStories, getReviews]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { HttpResponse, http } from "msw"; | ||
|
||
import { IResponsePlace } from "@/lib/types/place"; | ||
import { placeResponse } from "../response/place"; | ||
|
||
export const getPlaces = http.get<never, never, IResponsePlace>( | ||
`${process.env.API_HOST}/place`, | ||
() => { | ||
return HttpResponse.json(placeResponse); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { HttpResponse, http } from "msw"; | ||
|
||
import { reviewResponse } from "../response/review"; | ||
|
||
export const getReviews = http.get(`${process.env.API_HOST}/review`, () => { | ||
return HttpResponse.json(reviewResponse); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { HttpResponse, http } from "msw"; | ||
|
||
import { travelStoryResponse } from "../response/travelStory"; | ||
|
||
export const getTravelStories = http.get( | ||
`${process.env.API_HOST}/story`, | ||
() => { | ||
return HttpResponse.json(travelStoryResponse); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { IResponsePlace } from "@/lib/types/place"; | ||
|
||
export const placeResponse: IResponsePlace = { | ||
pageInfo: { | ||
page: 1, | ||
hasNext: 1, | ||
hasPrevious: 0, | ||
totalElements: 2, | ||
totalPages: 1, | ||
}, | ||
data: [ | ||
{ | ||
id: 1, | ||
placeId: "hdaasdasdasdasas", | ||
name: "서울", | ||
subName: "서울", | ||
}, | ||
{ | ||
id: 2, | ||
placeId: "asdasfasfasfas", | ||
name: "대전", | ||
subName: "대전", | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { IResponseReview } from "@/lib/types/travel"; | ||
|
||
export const reviewResponse: IResponseReview = { | ||
pageInfo: { | ||
page: 1, | ||
hasNext: 1, | ||
hasPrevious: 0, | ||
totalElements: 4, | ||
totalPages: 1, | ||
}, | ||
data: [ | ||
{ | ||
id: 1, | ||
score: 3.5, | ||
commentCount: 10, | ||
imageSrc: "https://www.ghibli.jp/gallery/ponyo016.jpg", | ||
title: "리뷰 1", | ||
description: "리뷰 1의 설명", | ||
userName: "yun", | ||
userImageSrc: "https://www.ghibli.jp/gallery/ponyo016.jpg", | ||
}, | ||
{ | ||
id: 2, | ||
score: 4, | ||
commentCount: 23, | ||
imageSrc: "https://www.ghibli.jp/gallery/ponyo016.jpg", | ||
title: "리뷰 2", | ||
description: "리뷰 2의 설명", | ||
userName: "yn", | ||
userImageSrc: "https://www.ghibli.jp/gallery/ponyo016.jpg", | ||
}, | ||
{ | ||
id: 3, | ||
score: 2.5, | ||
commentCount: 5, | ||
imageSrc: "https://www.ghibli.jp/gallery/ponyo016.jpg", | ||
title: "리뷰 3", | ||
description: "리뷰 3의 설명", | ||
userName: "ㅎㅎㅋㅋ", | ||
userImageSrc: "https://www.ghibli.jp/gallery/ponyo016.jpg", | ||
}, | ||
{ | ||
id: 4, | ||
score: 1.5, | ||
commentCount: 5, | ||
imageSrc: "https://www.ghibli.jp/gallery/ponyo016.jpg", | ||
title: "리뷰 4", | ||
description: "리뷰 4의 설명", | ||
userName: "nnnn", | ||
userImageSrc: "https://www.ghibli.jp/gallery/ponyo016.jpg", | ||
}, | ||
], | ||
}; |
Oops, something went wrong.