From 34ed19d14ebc8547443d7746e2b88915ef4159f3 Mon Sep 17 00:00:00 2001 From: bicochan Date: Wed, 28 May 2025 16:25:00 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20useAlertStore=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EB=B6=80=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../menu-authority/ui/management-authority-dialog.tsx | 2 +- apps/common/features/src/entities/menu/lib/menu-wrapper.tsx | 2 +- .../features/src/entities/posting/ui/posting-dialog.tsx | 2 +- apps/common/features/src/pages/(pst)/faq/ui/create-page.tsx | 2 +- apps/common/features/src/pages/(pst)/faq/ui/faq-page.tsx | 2 +- apps/common/features/src/pages/(pst)/faq/ui/modify-page.tsx | 2 +- apps/common/features/src/pages/(pst)/image/ui/create-page.tsx | 2 +- apps/common/features/src/pages/(pst)/image/ui/modify-page.tsx | 2 +- apps/common/features/src/pages/(pst)/movie/ui/create-page.tsx | 2 +- apps/common/features/src/pages/(pst)/movie/ui/modify-page.tsx | 2 +- .../common/features/src/pages/(pst)/normal/ui/create-page.tsx | 2 +- .../common/features/src/pages/(pst)/normal/ui/modify-page.tsx | 2 +- .../common/features/src/pages/(pst)/notice/ui/create-page.tsx | 2 +- .../common/features/src/pages/(pst)/notice/ui/modify-page.tsx | 2 +- apps/common/features/src/shared/ui/alert-dialog.tsx | 1 - .../features/src/widgets/post/ui/general-file-uploader.tsx | 2 +- apps/common/features/src/widgets/post/ui/post-comment.tsx | 2 +- apps/common/features/src/widgets/post/ui/post.tsx | 4 ++-- .../src/widgets/post/ui/with-preview-file-uploader.tsx | 2 +- .../menu-authority/ui/management-authority-dialog.tsx | 2 +- apps/cs/src/entities/menu/lib/menu-wrapper.tsx | 2 +- apps/cs/src/entities/posting/ui/posting-dialog.tsx | 3 ++- apps/cs/src/pages/(post)/faq/ui/create-page.tsx | 2 +- apps/cs/src/pages/(post)/faq/ui/faq-page.tsx | 2 +- apps/cs/src/pages/(post)/faq/ui/modify-page.tsx | 2 +- apps/cs/src/pages/(post)/image/ui/create-page.tsx | 2 +- apps/cs/src/pages/(post)/image/ui/modify-page.tsx | 2 +- apps/cs/src/pages/(post)/movie/ui/create-page.tsx | 2 +- apps/cs/src/pages/(post)/movie/ui/modify-page.tsx | 2 +- apps/cs/src/pages/(post)/normal/ui/create-page.tsx | 2 +- apps/cs/src/pages/(post)/normal/ui/modify-page.tsx | 2 +- apps/cs/src/pages/(post)/notice/ui/create-page.tsx | 2 +- apps/cs/src/pages/(post)/notice/ui/modify-page.tsx | 2 +- apps/cs/src/pages/banner/ui/create-page.tsx | 2 +- apps/cs/src/pages/banner/ui/modify-page.tsx | 2 +- apps/cs/src/pages/bbs/ui/create-page.tsx | 2 +- apps/cs/src/pages/bbs/ui/modify-page.tsx | 2 +- apps/cs/src/pages/code/ui/lwpocode-dialog.tsx | 2 +- apps/cs/src/pages/code/ui/upcode-dialog.tsx | 2 +- apps/cs/src/pages/contents/ui/create-page.tsx | 2 +- apps/cs/src/pages/contents/ui/modify-page.tsx | 2 +- apps/cs/src/pages/file/ui/file-page.tsx | 2 +- apps/cs/src/pages/image/ui/create-page.tsx | 2 +- apps/cs/src/pages/image/ui/modify-page.tsx | 2 +- apps/cs/src/pages/menu/ui/menu-page.tsx | 2 +- apps/cs/src/pages/module/ui/create-page.tsx | 2 +- apps/cs/src/pages/module/ui/management-authority-dialog.tsx | 2 +- apps/cs/src/pages/module/ui/modify-page.tsx | 2 +- apps/cs/src/pages/organization/ui/organization-page.tsx | 2 +- .../src/pages/organization/ui/user-organization-section.tsx | 2 +- apps/cs/src/pages/popup/ui/create-page.tsx | 2 +- apps/cs/src/pages/popup/ui/modify-page.tsx | 2 +- apps/cs/src/pages/recent/ui/recent-page.tsx | 2 +- apps/cs/src/pages/schedule/ui/create-page.tsx | 2 +- apps/cs/src/pages/schedule/ui/modify-page.tsx | 2 +- apps/cs/src/pages/site/ui/create-page.tsx | 2 +- apps/cs/src/pages/site/ui/domain-management-dialog.tsx | 2 +- apps/cs/src/pages/site/ui/ip-management-dialog.tsx | 2 +- apps/cs/src/pages/site/ui/modify-page.tsx | 2 +- apps/cs/src/pages/survey/ui/create-page.tsx | 2 +- apps/cs/src/pages/survey/ui/modify-page.tsx | 2 +- apps/cs/src/pages/survey/ui/survey-form.tsx | 3 --- apps/cs/src/pages/template/ui/create-page.tsx | 2 +- apps/cs/src/pages/template/ui/modify-page.tsx | 2 +- apps/cs/src/pages/terms/ui/create-page.tsx | 2 +- apps/cs/src/pages/terms/ui/modify-page.tsx | 2 +- apps/cs/src/widgets/post/ui/general-file-uploader.tsx | 2 +- apps/cs/src/widgets/post/ui/post-comment.tsx | 2 +- apps/cs/src/widgets/post/ui/post.tsx | 2 +- apps/cs/src/widgets/post/ui/with-preview-file-uploader.tsx | 2 +- 70 files changed, 70 insertions(+), 73 deletions(-) diff --git a/apps/common/features/src/entities/menu-authority/ui/management-authority-dialog.tsx b/apps/common/features/src/entities/menu-authority/ui/management-authority-dialog.tsx index d0b27b52c..b85c182b5 100644 --- a/apps/common/features/src/entities/menu-authority/ui/management-authority-dialog.tsx +++ b/apps/common/features/src/entities/menu-authority/ui/management-authority-dialog.tsx @@ -33,7 +33,7 @@ function ManagementAuthorityDialog({ ...props }: ManagementAuthorityDialogProps) { const { confirm } = useConfirm(); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const { data: menuAuthorityList } = useQuery({ queryKey: [ENDPOINT.CMS_SERVICE.MENU_AUTHRTS, menuCd], diff --git a/apps/common/features/src/entities/menu/lib/menu-wrapper.tsx b/apps/common/features/src/entities/menu/lib/menu-wrapper.tsx index 277cae8d3..1615dd572 100644 --- a/apps/common/features/src/entities/menu/lib/menu-wrapper.tsx +++ b/apps/common/features/src/entities/menu/lib/menu-wrapper.tsx @@ -13,7 +13,7 @@ const MenuWrapper = ({ children }: { children: React.ReactNode }) => { const router = useRouter(); const pathname = usePathname(); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const { pageMenuAuthority, setBbsInfo, diff --git a/apps/common/features/src/entities/posting/ui/posting-dialog.tsx b/apps/common/features/src/entities/posting/ui/posting-dialog.tsx index e125eb7a8..6bc8a02a7 100644 --- a/apps/common/features/src/entities/posting/ui/posting-dialog.tsx +++ b/apps/common/features/src/entities/posting/ui/posting-dialog.tsx @@ -61,7 +61,7 @@ const POSTING_TYPE_LABEL = { function PostingDialog({ postingType, postingTargets }: PostingDialogProps) { const { confirm } = useConfirm(); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const [selectedRows, setSelectedRows] = useState([]); const [rememberPeriodCode, setRememberPeriodCode] = useState< Record diff --git a/apps/common/features/src/pages/(pst)/faq/ui/create-page.tsx b/apps/common/features/src/pages/(pst)/faq/ui/create-page.tsx index 8b564cad4..92c70b707 100644 --- a/apps/common/features/src/pages/(pst)/faq/ui/create-page.tsx +++ b/apps/common/features/src/pages/(pst)/faq/ui/create-page.tsx @@ -11,7 +11,7 @@ import { useAlertStore, useUserStore } from "@/shared/lib"; function CreatePage({ bbsId }: { bbsId: string }) { const router = useRouter(); const { userInfo } = useUserStore((state) => state); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const { mutateAsync: createPost } = useMutation({ mutationFn: (data: PostFormData) => PostApi.createPost(data), diff --git a/apps/common/features/src/pages/(pst)/faq/ui/faq-page.tsx b/apps/common/features/src/pages/(pst)/faq/ui/faq-page.tsx index a5d7129d0..c0281504c 100644 --- a/apps/common/features/src/pages/(pst)/faq/ui/faq-page.tsx +++ b/apps/common/features/src/pages/(pst)/faq/ui/faq-page.tsx @@ -32,7 +32,7 @@ function FaqPage({ bbsId }: { bbsId: string }) { const pathname = usePathname(); const { confirm } = useConfirm(); const { userInfo } = useUserStore((state) => state); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const { bbsInfo, pageMenuAuthority } = useMenuStore((state) => state); const [postParams, setPostParams] = useState({ diff --git a/apps/common/features/src/pages/(pst)/faq/ui/modify-page.tsx b/apps/common/features/src/pages/(pst)/faq/ui/modify-page.tsx index 7f56031d9..244d30c4b 100644 --- a/apps/common/features/src/pages/(pst)/faq/ui/modify-page.tsx +++ b/apps/common/features/src/pages/(pst)/faq/ui/modify-page.tsx @@ -15,7 +15,7 @@ import { useAlertStore, useUserStore } from "@/shared/lib"; function ModifyPage({ bbsId, pstNo }: { bbsId: string; pstNo: string }) { const router = useRouter(); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const { userInfo } = useUserStore((state) => state); const { data: postInfo } = useQuery({ diff --git a/apps/common/features/src/pages/(pst)/image/ui/create-page.tsx b/apps/common/features/src/pages/(pst)/image/ui/create-page.tsx index 0efcd2c30..6931a96d0 100644 --- a/apps/common/features/src/pages/(pst)/image/ui/create-page.tsx +++ b/apps/common/features/src/pages/(pst)/image/ui/create-page.tsx @@ -11,7 +11,7 @@ import { useAlertStore, useUserStore } from "@/shared/lib"; function CreatePage({ bbsId }: { bbsId: string }) { const router = useRouter(); const { userInfo } = useUserStore((state) => state); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const { mutateAsync: createPost } = useMutation({ mutationFn: (data: PostFormData) => PostApi.createPost(data), diff --git a/apps/common/features/src/pages/(pst)/image/ui/modify-page.tsx b/apps/common/features/src/pages/(pst)/image/ui/modify-page.tsx index 8b09be8c3..01fcd3055 100644 --- a/apps/common/features/src/pages/(pst)/image/ui/modify-page.tsx +++ b/apps/common/features/src/pages/(pst)/image/ui/modify-page.tsx @@ -15,7 +15,7 @@ import { useAlertStore, useUserStore } from "@/shared/lib"; function ModifyPage({ bbsId, pstNo }: { bbsId: string; pstNo: string }) { const router = useRouter(); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const { userInfo } = useUserStore((state) => state); const { data: postInfo } = useQuery({ diff --git a/apps/common/features/src/pages/(pst)/movie/ui/create-page.tsx b/apps/common/features/src/pages/(pst)/movie/ui/create-page.tsx index f7e2e837f..2103bf6c8 100644 --- a/apps/common/features/src/pages/(pst)/movie/ui/create-page.tsx +++ b/apps/common/features/src/pages/(pst)/movie/ui/create-page.tsx @@ -11,7 +11,7 @@ import { useAlertStore, useUserStore } from "@/shared/lib"; function CreatePage({ bbsId }: { bbsId: string }) { const router = useRouter(); const { userInfo } = useUserStore((state) => state); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const { mutateAsync: createPost } = useMutation({ mutationFn: (data: PostFormData) => PostApi.createPost(data), diff --git a/apps/common/features/src/pages/(pst)/movie/ui/modify-page.tsx b/apps/common/features/src/pages/(pst)/movie/ui/modify-page.tsx index 6bbdd8d94..90ad811ca 100644 --- a/apps/common/features/src/pages/(pst)/movie/ui/modify-page.tsx +++ b/apps/common/features/src/pages/(pst)/movie/ui/modify-page.tsx @@ -15,7 +15,7 @@ import { useAlertStore, useUserStore } from "@/shared/lib"; function ModifyPage({ bbsId, pstNo }: { bbsId: string; pstNo: string }) { const router = useRouter(); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const { userInfo } = useUserStore((state) => state); const { data: postInfo } = useQuery({ diff --git a/apps/common/features/src/pages/(pst)/normal/ui/create-page.tsx b/apps/common/features/src/pages/(pst)/normal/ui/create-page.tsx index c5cbf7923..ce6bc6c8a 100644 --- a/apps/common/features/src/pages/(pst)/normal/ui/create-page.tsx +++ b/apps/common/features/src/pages/(pst)/normal/ui/create-page.tsx @@ -13,7 +13,7 @@ function CreatePage({ bbsId, pstNo }: { bbsId: string; pstNo?: string }) { const router = useRouter(); const { userInfo } = useUserStore((state) => state); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const { mutateAsync: createPost } = useMutation({ mutationFn: (data: PostFormData) => PostApi.createPost(data), diff --git a/apps/common/features/src/pages/(pst)/normal/ui/modify-page.tsx b/apps/common/features/src/pages/(pst)/normal/ui/modify-page.tsx index e0d1834d4..2c59ecff2 100644 --- a/apps/common/features/src/pages/(pst)/normal/ui/modify-page.tsx +++ b/apps/common/features/src/pages/(pst)/normal/ui/modify-page.tsx @@ -15,7 +15,7 @@ import { useAlertStore, useUserStore } from "@/shared/lib"; function ModifyPage({ bbsId, pstNo }: { bbsId: string; pstNo: string }) { const router = useRouter(); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const { userInfo } = useUserStore((state) => state); const { data: postInfo } = useQuery({ diff --git a/apps/common/features/src/pages/(pst)/notice/ui/create-page.tsx b/apps/common/features/src/pages/(pst)/notice/ui/create-page.tsx index 37c21cb0d..a0206f449 100644 --- a/apps/common/features/src/pages/(pst)/notice/ui/create-page.tsx +++ b/apps/common/features/src/pages/(pst)/notice/ui/create-page.tsx @@ -11,7 +11,7 @@ import { useAlertStore, useUserStore } from "@/shared/lib"; function CreatePage({ bbsId }: { bbsId: string }) { const router = useRouter(); const { userInfo } = useUserStore((state) => state); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const { mutateAsync: createPost } = useMutation({ mutationFn: (data: PostFormData) => PostApi.createPost(data), diff --git a/apps/common/features/src/pages/(pst)/notice/ui/modify-page.tsx b/apps/common/features/src/pages/(pst)/notice/ui/modify-page.tsx index 9fe65782d..3c1c517dc 100644 --- a/apps/common/features/src/pages/(pst)/notice/ui/modify-page.tsx +++ b/apps/common/features/src/pages/(pst)/notice/ui/modify-page.tsx @@ -15,7 +15,7 @@ import { useAlertStore, useUserStore } from "@/shared/lib"; function ModifyPage({ bbsId, pstNo }: { bbsId: string; pstNo: string }) { const router = useRouter(); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const { userInfo } = useUserStore((state) => state); const { data: postInfo } = useQuery({ diff --git a/apps/common/features/src/shared/ui/alert-dialog.tsx b/apps/common/features/src/shared/ui/alert-dialog.tsx index 012d4ab86..3bd4fece8 100644 --- a/apps/common/features/src/shared/ui/alert-dialog.tsx +++ b/apps/common/features/src/shared/ui/alert-dialog.tsx @@ -6,7 +6,6 @@ import { Button, } from "@common/components"; import { useAlertStore } from "../lib/use-alert-store"; - function AlertDialog() { const { message, callback, setMessage } = useAlertStore((state) => state); const handleOpenChange = () => { diff --git a/apps/common/features/src/widgets/post/ui/general-file-uploader.tsx b/apps/common/features/src/widgets/post/ui/general-file-uploader.tsx index 90edbc58b..24998ec58 100644 --- a/apps/common/features/src/widgets/post/ui/general-file-uploader.tsx +++ b/apps/common/features/src/widgets/post/ui/general-file-uploader.tsx @@ -17,7 +17,7 @@ function GeneralFileUploader({ deleteAttachmentIds: string[]; setDeleteAttachmentIds: (deleteAttachmentIds: string[]) => void; }) { - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const { bbsInfo } = useMenuStore((state) => state); const [attachments, setAttachments] = useState>( diff --git a/apps/common/features/src/widgets/post/ui/post-comment.tsx b/apps/common/features/src/widgets/post/ui/post-comment.tsx index 1800b2581..8c08cfc88 100644 --- a/apps/common/features/src/widgets/post/ui/post-comment.tsx +++ b/apps/common/features/src/widgets/post/ui/post-comment.tsx @@ -20,7 +20,7 @@ function PostComment({ bbsId, pstNo }: { bbsId: number; pstNo: number }) { const { confirm } = useConfirm(); const queryClient = useQueryClient(); const { userInfo } = useUserStore((state) => state); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const [editingCmntNo, setEditingCmntNo] = useState(null); const [editValue, setEditValue] = useState(""); diff --git a/apps/common/features/src/widgets/post/ui/post.tsx b/apps/common/features/src/widgets/post/ui/post.tsx index 44e549a70..e52a65d03 100644 --- a/apps/common/features/src/widgets/post/ui/post.tsx +++ b/apps/common/features/src/widgets/post/ui/post.tsx @@ -21,7 +21,7 @@ import { PostComment } from "./post-comment"; function Post({ bbsId, pstNo }: { bbsId: string; pstNo: string }) { const router = useRouter(); const { prompt } = usePrompt(); - const { setMessage: alert } = useAlertStore((state) => state); + const alert = useAlertStore((state) => state.setMessage); const { userInfo } = useUserStore((state) => state); const { bbsInfo } = useMenuStore((state) => state); @@ -168,7 +168,7 @@ function Post({ bbsId, pstNo }: { bbsId: string; pstNo: string }) {