replace axios with fetch
This commit is contained in:
parent
1470abbbde
commit
926a2c2407
|
@ -1,11 +1,13 @@
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import axios from "axios";
|
|
||||||
|
|
||||||
export const useClientSchedule = (clientId: string, key: string) => {
|
export const useClientSchedule = (clientId: string, key: string) => {
|
||||||
const { isLoading, error, data } = useQuery({
|
const { isLoading, error, data } = useQuery({
|
||||||
queryKey: ["schedule"],
|
queryKey: ["schedule"],
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
return axios.get(`/v2/schedules/${clientId}?apiKey=${key}`).then((res) => res.data);
|
return fetch(`/v2/schedules/${clientId}?apiKey=${key}`, {
|
||||||
|
method: "get",
|
||||||
|
headers: { "Content-type": "application/json" },
|
||||||
|
}).then((res) => res.json());
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import axios from "axios";
|
|
||||||
|
|
||||||
export const useProfileInfo = (key: string) => {
|
export const useProfileInfo = (key: string) => {
|
||||||
const { data } = useQuery({
|
const { data } = useQuery({
|
||||||
queryKey: ["user"],
|
queryKey: ["user"],
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
return axios.get(`/v2/me?apiKey=${key}`).then((res) => res.data);
|
return fetch(`/v2/me?apiKey=${key}`, {
|
||||||
|
method: "get",
|
||||||
|
headers: { "Content-type": "application/json" },
|
||||||
|
}).then((res) => res.json());
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user