- getListDateGroup 수정
- 알림톡 필터 추가 - 일부 부가서비스 엑셀다운로드 바텀시트 추가
This commit is contained in:
@@ -13,7 +13,6 @@ import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constant';
|
||||
import { useExtensionLinkPayHistoryDownloadExcelMutation } from '../../api/link-payment/use-extension-link-pay-history-download-excel-mutation';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { ExtensionLinkPayHistoryListParams, LinkPaymentHistoryListItem, LinkPaymentPaymentMethod, LinkPaymentPaymentStatus, LinkPaymentSearchCl, LinkPaymentSendMethod, LinkPaymentSendStatus } from '../../model/link-pay/types';
|
||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||
|
||||
const paymentResultBtnGroup = [
|
||||
{ name: '전체', value: LinkPaymentPaymentStatus.ALL },
|
||||
@@ -27,30 +26,10 @@ const paymentResultBtnGroup = [
|
||||
export const LinkPaymentHistoryWrap = () => {
|
||||
const { navigate } = useNavigate();
|
||||
const userMid = useStore.getState().UserStore.mid;
|
||||
const [onActionIntersect, setOnActionIntersect] = useState<boolean>(false);
|
||||
const onIntersect: IntersectionObserverCallback = (entries: Array<IntersectionObserverEntry>) => {
|
||||
entries.forEach((entry: IntersectionObserverEntry) => {
|
||||
if (entry.isIntersecting) {
|
||||
console.log('Element is now intersecting with the root. [' + onActionIntersect + ']');
|
||||
if (onActionIntersect) {
|
||||
callList();
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.log('Element is no longer intersecting with the root.');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const { setTarget } = useIntersectionObserver({
|
||||
threshold: 1,
|
||||
onIntersect
|
||||
});
|
||||
|
||||
const [filterOn, setFilterOn] = useState<boolean>(false);
|
||||
const [sortType, setSortType] = useState<SortTypeKeys>(SortTypeKeys.LATEST);
|
||||
const [listItems, setListItems] = useState<Array<LinkPaymentHistoryListItem>>([]);
|
||||
const [nextCursor, setNextCursor] = useState<string | null>(null);
|
||||
const [pageParam, setPageParam] = useState<DefaultRequestPagination>(DEFAULT_PAGE_PARAM);
|
||||
|
||||
const [mid, setMid] = useState<string>(userMid);
|
||||
@@ -74,17 +53,8 @@ export const LinkPaymentHistoryWrap = () => {
|
||||
|
||||
const callList = (option?: {
|
||||
sortType?: SortTypeKeys,
|
||||
status?: LinkPaymentPaymentStatus,
|
||||
resetPage?: boolean
|
||||
status?: LinkPaymentPaymentStatus
|
||||
}) => {
|
||||
setOnActionIntersect(false);
|
||||
|
||||
const currentPageParam = option?.resetPage
|
||||
? { ...DEFAULT_PAGE_PARAM, sortType: option?.sortType ?? sortType }
|
||||
: { ...pageParam, sortType: option?.sortType ?? sortType };
|
||||
|
||||
setPageParam(currentPageParam); // currentPageParam으로 수정!
|
||||
|
||||
let listParams: ExtensionLinkPayHistoryListParams = {
|
||||
mid: mid,
|
||||
searchCl: searchCl,
|
||||
@@ -94,27 +64,16 @@ export const LinkPaymentHistoryWrap = () => {
|
||||
paymentStatus: option?.status ?? paymentStatus,
|
||||
sendStatus: sendStatus,
|
||||
sendMethod: sendMethod,
|
||||
... {
|
||||
page: currentPageParam
|
||||
}
|
||||
page: pageParam
|
||||
};
|
||||
|
||||
if (listParams.page) {
|
||||
listParams.page.sortType = option?.sortType || sortType;
|
||||
setPageParam(listParams.page);
|
||||
}
|
||||
|
||||
linkPayHistoryList(listParams).then((rs) => {
|
||||
setListItems(option?.resetPage ? rs.content : [
|
||||
...listItems,
|
||||
...rs.content
|
||||
]);
|
||||
if (rs.hasNext) {
|
||||
setNextCursor(rs.nextCursor);
|
||||
setPageParam({
|
||||
...currentPageParam, // pageParam이 아니라 currentPageParam 사용
|
||||
cursor: rs.nextCursor
|
||||
});
|
||||
setOnActionIntersect(true)
|
||||
}
|
||||
else {
|
||||
setNextCursor(null);
|
||||
}
|
||||
setListItems(rs.content);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -138,16 +97,14 @@ export const LinkPaymentHistoryWrap = () => {
|
||||
const onClickPaymentStatus = (val: LinkPaymentPaymentStatus) => {
|
||||
setPaymentStatus(val);
|
||||
callList({
|
||||
status: val,
|
||||
resetPage: true
|
||||
status: val
|
||||
})
|
||||
}
|
||||
|
||||
const onClickToSort = (sort: SortTypeKeys) => {
|
||||
setSortType(sort);
|
||||
callList({
|
||||
sortType: sort,
|
||||
resetPage: true
|
||||
sortType: sort
|
||||
});
|
||||
};
|
||||
|
||||
@@ -156,8 +113,7 @@ export const LinkPaymentHistoryWrap = () => {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
// 필터 조건이 변경되면 첫 페이지부터 다시 시작
|
||||
callList({ resetPage: true });
|
||||
callList();
|
||||
}, [
|
||||
mid,
|
||||
searchCl,
|
||||
@@ -227,7 +183,6 @@ export const LinkPaymentHistoryWrap = () => {
|
||||
<LinkPaymentHistoryList
|
||||
listItems={listItems}
|
||||
additionalServiceCategory={AdditionalServiceCategory.LinkPaymentHistory}
|
||||
setTarget={setTarget}
|
||||
mid={mid}
|
||||
></LinkPaymentHistoryList>
|
||||
<div className="apply-row">
|
||||
|
||||
Reference in New Issue
Block a user