Skip to content

Commit

Permalink
Merge pull request #172 from prgrms-web-devcourse-final-project/feat/#…
Browse files Browse the repository at this point in the history
…150

Feat/#150 굿즈, 메이트 채팅 연동, 리스트 데이터 산출
  • Loading branch information
w-ho-choo authored Dec 7, 2024
2 parents 143be08 + 321bd3a commit f1f8a0a
Show file tree
Hide file tree
Showing 48 changed files with 1,227 additions and 186 deletions.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@
type="module"
src="/src/main.tsx"
></script>
<script>
const global = globalThis
</script>
</body>
</html>
131 changes: 129 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"react-kakao-maps-sdk": "^1.1.27",
"react-loading-skeleton": "^3.5.0",
"react-router-dom": "^6.28.0",
"sockjs-client": "^1.6.1",
"styled-components": "^6.1.13",
"styled-normalize": "^8.1.1",
"swiper": "^11.1.14",
Expand All @@ -33,6 +34,7 @@
"@types/node": "^22.9.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/sockjs-client": "^1.5.4",
"@typescript-eslint/parser": "^7.0.0",
"@vitejs/plugin-react": "^4.3.3",
"eslint": "^8.2.0",
Expand Down
32 changes: 18 additions & 14 deletions src/apis/goodsChatService.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
import {
GoodsChatParticipantResponse,
GoodsChatroom,
GoodsChatroomResponse,
} from '@typings/db'
import fetchApi from './ky'

const goodsChatService = {
createGoodsChatroom: async (buyerId: number, goodsPostId: number) => {
createGoodsChatroom: async (buyerId: number, goodsPostId: string) => {
const response = await fetchApi
.post(`goods/chat?buyerId=${buyerId}&goodsPostId=${goodsPostId}`)
.json()

return response
},

getGoodsChatList: async (memberId: number, page: number, size: number) => {
// 채팅 페이지 => 채팅방 목록
getGoodsChatroomList: async (page: number, size: number) => {
const response = await fetchApi
.get(`goods/chat?memberId=${memberId}&page=${page}&size=${size}`)
.get<GoodsChatroomResponse>(`goods/chat?page=${page}&size=${size}`)
.json()

return response
return response.data
},

// 채팅 페이지 => 채팅방 상세
getGoodsChatroom: async (chatRoomId: number, memberId: number) => {
getGoodsChatroom: async (chatRoomId: string) => {
const response = await fetchApi
.get(`goods/chat/${chatRoomId}?memberId=${memberId}`)
.get<GoodsChatroomResponse>(`goods/chat/${chatRoomId}`)
.json()

return response
return response.data
},

getChatList: async (
Expand All @@ -41,20 +47,18 @@ const goodsChatService = {
return response
},

exitGoodsChat: async (chatRoomId: number, memberId: number) => {
const response = await fetchApi
.delete(`goods/chat/${chatRoomId}?memberId=${memberId}`)
.json()
exitGoodsChat: async (chatRoomId: string) => {
const response = await fetchApi.delete(`goods/chat/${chatRoomId}`).json()

return response
},

goodsParticipantList: async (chatRoomId: number, memberId: number) => {
goodsParticipantList: async (chatRoomId: string) => {
const response = await fetchApi
.get(`goods/chat/${chatRoomId}/members?memberId=${memberId}`)
.get<GoodsChatParticipantResponse>(`goods/chat/${chatRoomId}/members`)
.json()

return response
return response.data
},
}

Expand Down
28 changes: 8 additions & 20 deletions src/apis/goodsPostService.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
import { GoodsDetailResponse, GoodsListResponse } from '@typings/db'
import fetchApi from './ky'
const goodsPostService = {
postGoodsPost: async (memberId: number, formData: FormData) => {
const response = await fetchApi
.post(`goods/${memberId}`, { body: formData })
.json()
postGoodsPost: async (formData: FormData) => {
const response = await fetchApi.post(`goods`, { body: formData }).json()

return response
},

editGoodsPost: async (
memberId: number,
goodsId: number,
formData: FormData,
) => {
editGoodsPost: async (goodsId: number, formData: FormData) => {
const response = await fetchApi
.put(`goods/${memberId}/post/${goodsId}`, { body: formData })
.put(`goods/${goodsId}`, { body: formData })
.json()

return response
Expand All @@ -35,21 +29,15 @@ const goodsPostService = {
return response
},

deleteGoodsPost: async (memberId: number, goodsPostId: number) => {
const response = await fetchApi
.delete(`goods/${memberId}/post/${goodsPostId}`)
.json()
deleteGoodsPost: async (goodsPostId: number) => {
const response = await fetchApi.delete(`goods/${goodsPostId}`).json()

return response
},

completeGoodsPost: async (
memberId: number,
goodsPostId: number,
buyerId: number,
) => {
completeGoodsPost: async (goodsPostId: string, buyerId: string) => {
const response = await fetchApi
.post(`goods/${memberId}/post/${goodsPostId}/complete?buyerId=${buyerId}`)
.post(`goods/${goodsPostId}/complete?buyerId=${buyerId}`)
.json()

return response
Expand Down
Loading

0 comments on commit f1f8a0a

Please sign in to comment.