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 ⭐️

611 B
Raw Blame
import {useQuery} from "@tanstack/react-query";
import {IdParam, Organizer} from "../types.ts";
import {organizerClient} from "../api/organizer.client.ts";
import {AxiosError} from "axios";

export const GET_ORGANIZER_QUERY_KEY = 'getOrganizer';

export const useGetOrganizer = (organizerId: IdParam) => {
    return useQuery<Organizer, AxiosError>({
        queryKey: [GET_ORGANIZER_QUERY_KEY, organizerId],
        queryFn: async (): Promise<Organizer> => {
            const {data} = await organizerClient.findByID(organizerId);
            return data;
        },
        enabled: !!organizerId,
    });
}