custom hooks for availability component

This commit is contained in:
Ryukemeister 2023-12-11 14:48:44 +05:30
parent 345032f005
commit 70b25e70be
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,13 @@
import { useQuery } from "@tanstack/react-query";
import axios from "axios";
export const useClientSchedule = (clientId: string, key: string) => {
const { isLoading, error, data } = useQuery({
queryKey: ["schedule"],
queryFn: () => {
return axios.get(`/v2/schedules/${clientId}?apiKey=${key}`).then((res) => res.data);
},
});
return { isLoading, error, data };
};

View File

@ -0,0 +1,13 @@
import { useQuery } from "@tanstack/react-query";
import axios from "axios";
export const useProfileInfo = (key: string) => {
const { data } = useQuery({
queryKey: ["user"],
queryFn: () => {
return axios.get(`/v2/me?apiKey=${key}`).then((res) => res.data);
},
});
return { data };
};