Skip to content

Commit

Permalink
[Hotfix] 기업 승인
Browse files Browse the repository at this point in the history
[Hotfix] 기업 승인
  • Loading branch information
tjrmswo authored Apr 18, 2024
2 parents 292e790 + dfecb35 commit fd3d576
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/app/components/adminComponents/AdminModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,25 @@ const AdminModal: React.FC<ModalType> = ({
setCompanyData,
setSelectedData,
}) => {
// const queryclient = useQueryClient();
// queryclient.invalidateQueries(["getCompanyData"]);
const queryclient = useQueryClient();

const handleModal = () => {
setIsVisible(false);
};

const { isLoading, error, refetch } = useQuery({
queryKey: ["getCompanyData"],
queryFn: async () => {
const response = await userAxiosWithAuth.get(
`${process.env.NEXT_PUBLIC_BASE_URL}/admin/companies`
);

setCompanyData(response.data.data);
return response;
},
enabled: false, // 초기에는 실행하지 않도록 설정
});

const approveCompany = useMutation({
mutationFn: async () => {
const body = {
Expand All @@ -76,7 +89,9 @@ const AdminModal: React.FC<ModalType> = ({
}));
}
},
onSuccess: () => {},
onSuccess: () => {
refetch();
},
onError: (e) => {
console.log(e.message);
},
Expand Down Expand Up @@ -107,19 +122,6 @@ const AdminModal: React.FC<ModalType> = ({
},
});

const { isLoading, error, refetch } = useQuery({
queryKey: ["getCompanyData"],
queryFn: async () => {
const response = await userAxiosWithAuth.get(
`${process.env.NEXT_PUBLIC_BASE_URL}/admin/companies`
);

setCompanyData(response.data.data);
return response;
},
enabled: false, // 초기에는 실행하지 않도록 설정
});

if (isLoading) return <div>로딩중...</div>;
if (error) return <div>{error.message}</div>;

Expand Down

0 comments on commit fd3d576

Please sign in to comment.