import { useMutation, useQueryClient, } from '@tanstack/react-query';
import { NullSeamClientError, useSeamClient } from '../../../lib/seam/use-seam-client.js';
export function useUpdateAccessCode() {
    const { client } = useSeamClient();
    const queryClient = useQueryClient();
    return useMutation({
        mutationFn: async (mutationParams) => {
            if (client === null)
                throw new NullSeamClientError();
            return await client.accessCodes.update(mutationParams);
        },
        onSuccess: (_data, variables) => {
            void queryClient.invalidateQueries([
                'access_codes',
                'get',
                { access_code_id: variables.access_code_id },
            ]);
            void queryClient.invalidateQueries(['access_codes', 'list']);
        },
    });
}
//# sourceMappingURL=use-update-access-code.js.map