custom hooks for availability component
This commit is contained in:
parent
345032f005
commit
70b25e70be
|
@ -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 };
|
||||
};
|
|
@ -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 };
|
||||
};
|
Loading…
Reference in New Issue
Block a user