![](/img/trans.png)
[英]how to send credentials on an image with crossOrigin="use-credentials" when the http-server has "Access-Control-Allow-Credentials"="true"?
[英]How to use with credentials: true with TanStack Query fetch
以前我使用 axios request withcredentials:true 從服務器站點獲取 cookie 當我開始使用 TanStack Query/react Query 的 useQuery 來獲取數據時,我無法發送 withCredentials: true。 所以我無法從服務器站點獲取任何 cookie。 當我使用 TanStack 查詢的 useQuery 獲取時,任何人都可以幫助我如何發送 withCredentials 嗎?
我一直試圖獲得有關如何將 React Query 或 TanStack 查詢與憑據一起使用的答案。
React 查詢不執行任何抓取,您可以繼續使用 axios。
const { data } = useQuery([some, key], async () => {
const { data } = await axios.get('SOME_URL', { withCredentials: true })
return data
}}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.