chore: 팝업 작동 요청사항 반영
This commit is contained in:
@@ -37,25 +37,25 @@ type ManagementAuthorityDialogProps = {
|
||||
} & React.ComponentProps<typeof Dialog>;
|
||||
|
||||
const ManagementAuthorityDialog = memo(
|
||||
({ authorizationNo, rowData, ...props }: ManagementAuthorityDialogProps) => {
|
||||
({ authorizationNo, rowData }: ManagementAuthorityDialogProps) => {
|
||||
const { confirm } = useConfirm();
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
|
||||
const [isOpened, setIsOpened] = useState(false);
|
||||
const [open, setOpen] = useState(false);
|
||||
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
|
||||
|
||||
const query = useQuery({
|
||||
queryKey: [ENDPOINT.USER_SERVICE.ROLE_AUTHORIZATIONS, authorizationNo],
|
||||
queryFn: () =>
|
||||
RoleAuthorizationsApi.getRoleAuthorizationsList({ authorizationNo }),
|
||||
enabled: !!authorizationNo && isOpened,
|
||||
enabled: !!authorizationNo && open,
|
||||
});
|
||||
|
||||
const { mutateAsync: saveRoleAuthorization } = useMutationWrapper({
|
||||
mutationFn: (data: RoleAuthorizationsData) =>
|
||||
RoleAuthorizationsApi.createRoleAuthorizations(data),
|
||||
onSuccess: () => {
|
||||
alert("저장되었습니다.");
|
||||
alert("저장되었습니다.", () => setOpen(false));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -91,11 +91,9 @@ const ManagementAuthorityDialog = memo(
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog {...props}>
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<Button size="sm" onClick={() => setIsOpened(true)}>
|
||||
관리
|
||||
</Button>
|
||||
<Button size="sm">관리</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent className="max-w-[60rem]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
@@ -13,6 +14,7 @@ import {
|
||||
import { ModuleForm } from "./module-form";
|
||||
|
||||
function ModifyPage({ sequential }: { sequential: string }) {
|
||||
const router = useRouter();
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
|
||||
const { data: authorizationInfo } = useQuery({
|
||||
@@ -24,7 +26,7 @@ function ModifyPage({ sequential }: { sequential: string }) {
|
||||
mutationFn: (data: AuthorizationFormData) =>
|
||||
AuthorizationsApi.updateAuthorization(sequential, data),
|
||||
onSuccess: () => {
|
||||
alert("수정되었습니다.");
|
||||
alert("수정되었습니다.", router.back);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user