({
+ message: "클립보드에 복사되었습니다!",
+ isTop: true,
+ });
+
+ //토스트 메세지, 위치를 정하는 유틸 함수
+ const handleToastVisible = (message: string, position: "top" | "bottom") => {
+ const isTop = position === "top" ? true : false;
+ setToastConfig({ message, isTop });
+ showToast();
+ };
+
+ /*
+ toastConfig: Toast 속성에 사용,
+ isToastVisible : Toast의 isVisible 속성에 사용
+ handleToastVisible : Toast를 사용하기 위한 함수
+ */
+ return { toastConfig, isToastVisible, handleToastVisible };
+};
+
+export default useToastHandler;
diff --git a/src/pages/book/components/paidBook/PaidBook.tsx b/src/pages/book/components/paidBook/PaidBook.tsx
index 00386681..b6f4165a 100644
--- a/src/pages/book/components/paidBook/PaidBook.tsx
+++ b/src/pages/book/components/paidBook/PaidBook.tsx
@@ -89,7 +89,7 @@ const PaidBook = ({
- } isVisible={isToastVisible} toastBottom={52}>
+ } isVisible={isToastVisible} isTop={true}>
클립보드에 복사되었습니다!
diff --git a/src/pages/cancel/Cancel.tsx b/src/pages/cancel/Cancel.tsx
index e2c04ed2..f459f641 100644
--- a/src/pages/cancel/Cancel.tsx
+++ b/src/pages/cancel/Cancel.tsx
@@ -80,7 +80,6 @@ const Cancel = () => {
};
confirmCancelAction(requestData);
- alert("hi");
};
if (!state) {
diff --git a/src/pages/gig/components/performanceIntroduce/Contact.tsx b/src/pages/gig/components/performanceIntroduce/Contact.tsx
index 16dbe83c..3f9a6245 100644
--- a/src/pages/gig/components/performanceIntroduce/Contact.tsx
+++ b/src/pages/gig/components/performanceIntroduce/Contact.tsx
@@ -34,7 +34,7 @@ const Contact = ({ contact }: ContactProps) => {
)}
- } isVisible={isToastVisible} toastBottom={100}>
+ } isVisible={isToastVisible} isTop={true}>
클립보드에 복사되었습니다!
diff --git a/src/pages/gig/components/performanceIntroduce/PerformanceIntroduce.tsx b/src/pages/gig/components/performanceIntroduce/PerformanceIntroduce.tsx
index fbafd8a3..d6523b50 100644
--- a/src/pages/gig/components/performanceIntroduce/PerformanceIntroduce.tsx
+++ b/src/pages/gig/components/performanceIntroduce/PerformanceIntroduce.tsx
@@ -127,7 +127,7 @@ const PerformanceIntroduce = ({
- } isVisible={isToastVisible} toastBottom={30}>
+ } isVisible={isToastVisible} isTop={true}>
클립보드에 복사되었습니다!
diff --git a/src/pages/test/TestPage.tsx b/src/pages/test/TestPage.tsx
index 0d962e63..7141b537 100644
--- a/src/pages/test/TestPage.tsx
+++ b/src/pages/test/TestPage.tsx
@@ -93,7 +93,7 @@ const TestPage = () => {
- } isVisible={isToastVisible} toastBottom={30}>
+ } isVisible={isToastVisible} isTop={true}>
클립보드에 복사되었습니다!
diff --git a/src/pages/test/modalTest/BankAccount.tsx b/src/pages/test/modalTest/BankAccount.tsx
index 001b5099..fcdd1323 100644
--- a/src/pages/test/modalTest/BankAccount.tsx
+++ b/src/pages/test/modalTest/BankAccount.tsx
@@ -49,7 +49,7 @@ const BankAccount = ({ bankName, number, accountName, accountNumber, price }: Ba
- } isVisible={isToastVisible} toastBottom={30}>
+ } isVisible={isToastVisible} isTop={true}>
클립보드에 복사되었습니다!
diff --git a/src/pages/ticketholderlist/TicketHolderList.tsx b/src/pages/ticketholderlist/TicketHolderList.tsx
index 0a7b4031..ab7ffacf 100644
--- a/src/pages/ticketholderlist/TicketHolderList.tsx
+++ b/src/pages/ticketholderlist/TicketHolderList.tsx
@@ -27,9 +27,9 @@ import SelectedChips from "./components/selectedChips/SelectedChips";
import { convertingBookingStatus } from "@constants/convertingBookingStatus";
import { IconCheck } from "@assets/svgs";
import Toast from "@components/commons/toast/Toast";
-import { useToast } from "@hooks";
import NonExistent from "./components/nonExistent/NonExistent.";
import { getUA, isChrome } from "react-device-detect";
+import { useToastHandler } from "@hooks";
export type PaymentType =
| "CHECKING_PAYMENT"
@@ -66,10 +66,7 @@ const headers = [
];
const TicketHolderList = () => {
- const [toastConfig, setToastConfig] = useState({
- message: "클립보드에 복사되었습니다!",
- isTop: false,
- });
+ const { toastConfig, isToastVisible, handleToastVisible } = useToastHandler();
const [paymentData, setPaymentData] = useState();
const [allBookings, setAllBookings] = useState([]); // 전체 예매자 정보 (필터 적용 안 된)
@@ -102,9 +99,7 @@ const TicketHolderList = () => {
filterList
);
const { openConfirm, closeConfirm } = useModal();
-
const [checkedBookingId, setCheckedBookingId] = useState([]);
- const { showToast, isToastVisible } = useToast();
// 체크된 리스트 확인
const handleBookingIdCheck = (bookingId: number) => {
setCheckedBookingId((prev) =>
@@ -114,13 +109,6 @@ const TicketHolderList = () => {
const { mutate: updateMutate, isPending: updateIsPending } = useTicketUpdate();
- //토스트 메세지, 위치를 정하는 유틸 함수
- const handleToastVisible = (message: string, position: "top" | "bottom") => {
- const isTop = position === "top" ? true : false;
- setToastConfig({ message, isTop });
- showToast();
- };
-
const handlePaymentFixAxiosFunc = () => {
if (updateIsPending) {
return;
@@ -477,7 +465,7 @@ const TicketHolderList = () => {
const handleCopyClipBoard = (text: string) => {
navigator.clipboard.writeText(text);
- handleToastVisible("클립보드에 복사되었습니다!", "bottom");
+ handleToastVisible("클립보드에 복사되었습니다!", "top");
};
return (