bill92
02/01/2022, 10:26 PMwithCredentials
and set it to true
. Is this expected?
ts
import axios, { AxiosError } from "axios";
import { useQuery, UseQueryResult } from "react-query";
import { PatientResponse } from "../lib/types/patient";
const getPatients = async () => {
const { data } = await axios.get<PatientResponse>(
"http://localhost:5555/patient",
{
headers: {
"Content-Type": "application/json",
},
withCredentials: true,
}
);
return data;
};
export const useGetPatients = (): UseQueryResult<
PatientResponse,
AxiosError
> => {
return useQuery(["patients"], getPatients);
};