19 lines
437 B
TypeScript
19 lines
437 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { axiosClient } from '@/lib/axios';
|
|
|
|
export function useCheckinCode(eventId: string, enabled: boolean) {
|
|
return useQuery({
|
|
queryKey: ['getCheckinCode', eventId],
|
|
queryFn: async () => {
|
|
return axiosClient.get<{
|
|
checkin_code: string;
|
|
}>('/user/checkin', {
|
|
params: {
|
|
event_id: eventId,
|
|
},
|
|
});
|
|
},
|
|
enabled,
|
|
});
|
|
}
|