TanStackT
TanStack3y ago
3 replies
ripe-gray

Property 'data' does not exist on type 'Promise<{...

I am very new to react query, I think my solution is very simple and im being stupid.. But I cant figure it out.
export async function useFetchAccessToken() { const { data, isSuccess, isLoading, isError } = useQuery({ queryKey: ["accessToken"], queryFn: async () => await axios.get('${endpoint}${URL.accessToken}', { withCredentials: true, }), }); return { data, isSuccess, isLoading, isError }; }

const { data, isSuccess, isLoading, isError } = useFetchAccessToken();

And this is the error - Property 'data' does not exist on type 'Promise<{ data: AxiosResponse<any, any> | undefined; isSuccess: boolean; isLoading: boolean; isError: boolean; }>'.ts(2339)

Sorry if its a very simple and basic solution..
Was this page helpful?