Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

729 B
Raw Blame
import {useMutation, useQueryClient} from "@tanstack/react-query";
import {adminClient} from "../api/admin.client";
import {IdParam} from "../types";
import {GET_ADMIN_ACCOUNT_QUERY_KEY} from "../queries/useGetAdminAccount";
import {GET_ALL_ACCOUNTS_QUERY_KEY} from "../queries/useGetAllAccounts";

export const useAdminUnsuspendAccount = (accountId: IdParam) => {
    const queryClient = useQueryClient();

    return useMutation({
        mutationFn: () => adminClient.unsuspendAccount(accountId),
        onSuccess: () => Promise.all([
            queryClient.invalidateQueries({queryKey: GET_ADMIN_ACCOUNT_QUERY_KEY}),
            queryClient.invalidateQueries({queryKey: GET_ALL_ACCOUNTS_QUERY_KEY}),
        ]),
    });
};