-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into feature/#228
- Loading branch information
Showing
54 changed files
with
1,047 additions
and
198 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,30 @@ | ||
import { ProductItem } from '@/types/sale/type'; | ||
import { apiClient } from '../user/apiClient'; | ||
|
||
//31. 판매할 숙박권 기본정보 조회 | ||
export const getSaleProduct = async (id: number) => { | ||
const res = await apiClient.get(`/v1/sales/yanolja/product/detail?id=${id}`); | ||
return res.data; | ||
}; | ||
|
||
//32. 상품 등록 | ||
export const postSaleProduct = async (product: ProductItem) => { | ||
const res = await apiClient.post(`/v1/sales/product`, product); | ||
return res.data; | ||
}; | ||
//34. 상품 삭제 | ||
export const deleteSaleProduct = async (id: number) => { | ||
const res = await apiClient.delete(`/v1/sales/product?id=${id}`); | ||
return res.data; | ||
}; | ||
|
||
//48. 상품 기존 등록정보 불러오기 | ||
export const getProductInfo = async (id: number) => { | ||
const res = await apiClient.get(`/v1/sales/edit/info/product?id=${id}`); | ||
return res.data; | ||
}; | ||
|
||
//33. 상품 수정 | ||
export const putProductInfo = async (product: ProductItem, id: number) => { | ||
const res = await apiClient.put(`/v1/sales/product?id=${id}`, product); | ||
return res.data; | ||
}; |
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,45 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
import { useCookies } from 'react-cookie'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
// import InfiniteScroll from 'react-infinite-scroller'; | ||
import LoginButton from '../LoginButton'; | ||
import axios from 'axios'; | ||
|
||
const fetchPage = async (token: string) => { | ||
const res = await axios.get( | ||
'https://catchroom.xyz/v1/chat/room/info?roomId=df16caeb-d73a-470a-af14-b7edf276ddc2', | ||
{ | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}, | ||
); | ||
|
||
const result = await res.data; | ||
return result; | ||
}; | ||
|
||
const InfiniteScrollWrapper = () => { | ||
const [cookies] = useCookies(); | ||
const token = cookies.accessToken; | ||
|
||
const { data: asdfasdf, error } = useQuery({ | ||
queryKey: ['messages'], | ||
queryFn: () => fetchPage(token), | ||
}); | ||
|
||
console.log('data불러오기', asdfasdf); | ||
|
||
console.log('에러', error); | ||
|
||
return ( | ||
<div> | ||
<LoginButton /> | ||
<div>안녕안녕</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default InfiniteScrollWrapper; |
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,6 @@ | ||
import { atom } from 'recoil'; | ||
|
||
export const isFromSalePageState = atom<boolean>({ | ||
key: 'isFromSalePageState', | ||
default: false, | ||
}); |
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,16 @@ | ||
import { atom } from 'recoil'; | ||
|
||
export const isProductState = atom<boolean>({ | ||
key: 'isProductState', | ||
default: false, | ||
}); | ||
|
||
export const isNegoState = atom<boolean>({ | ||
key: 'isNegoState', | ||
default: false, | ||
}); | ||
|
||
export const sellerContentState = atom<string>({ | ||
key: 'sellerContentState', | ||
default: '', | ||
}); |
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,77 @@ | ||
'use client'; | ||
|
||
import { infinitePreviousChat } from '@/api/chat/api'; | ||
import React from 'react'; | ||
import { useCookies } from 'react-cookie'; | ||
import InfiniteScroll from 'react-infinite-scroll-component'; | ||
import { useInfiniteQuery } from '@tanstack/react-query'; | ||
import MessageItem from '../messageItem'; | ||
import { MessageItemProps } from '@/types/chat/chatRoom/types'; | ||
|
||
const InfiniteScrollWrapper = ({ | ||
accept, | ||
deny, | ||
roomId, | ||
}: { | ||
accept: (price: number) => void; | ||
deny: (price: number) => void; | ||
roomId: string; | ||
}) => { | ||
const [cookies] = useCookies(); | ||
const token = cookies.accessToken; | ||
|
||
const { data, fetchNextPage, hasNextPage } = useInfiniteQuery({ | ||
queryKey: ['messages'], | ||
queryFn: ({ pageParam }) => | ||
infinitePreviousChat({ pageParam, roomId, token }), | ||
initialPageParam: 1, | ||
getNextPageParam: (lastPage, allPages, lastPageParam) => { | ||
if (lastPage.length === 0) { | ||
return undefined; | ||
} | ||
|
||
return lastPageParam + 1; | ||
}, | ||
}); | ||
|
||
return ( | ||
<InfiniteScroll | ||
dataLength={data?.pages.length || 0} | ||
next={fetchNextPage} | ||
hasMore={hasNextPage} | ||
inverse={true} | ||
scrollableTarget="scrollableDiv" | ||
loader={<div className="loader" key={0}></div>} | ||
> | ||
<div | ||
id="scrollableDiv" | ||
className="w-full max-h-[calc(100vh-200px)] overflow-auto flex flex-col-reverse" | ||
> | ||
{' '} | ||
{data ? ( | ||
data.pages.map((page, pageIndex) => ( | ||
<div key={pageIndex}> | ||
{page.map((item: MessageItemProps, index: number) => ( | ||
<MessageItem | ||
accept={accept} | ||
deny={deny} | ||
key={index} | ||
type={item.type} | ||
message={item.message as string} | ||
userId={item.userId as number} | ||
roomId={item.roomId as string} | ||
time={item.time as string} | ||
negoPrice={item.negoPrice as number} | ||
/> | ||
))} | ||
</div> | ||
)) | ||
) : ( | ||
<></> | ||
)} | ||
</div> | ||
</InfiniteScroll> | ||
); | ||
}; | ||
|
||
export default InfiniteScrollWrapper; |
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
Oops, something went wrong.