replace axios with fetch

This commit is contained in:
Ryukemeister 2023-12-20 12:07:08 +05:30
parent 1470abbbde
commit 926a2c2407
2 changed files with 8 additions and 4 deletions

View File

@ -1,11 +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 fetch(`/v2/schedules/${clientId}?apiKey=${key}`, {
method: "get",
headers: { "Content-type": "application/json" },
}).then((res) => res.json());
},
});

View File

@ -1,11 +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 fetch(`/v2/me?apiKey=${key}`, {
method: "get",
headers: { "Content-type": "application/json" },
}).then((res) => res.json());
},
});