RTK查询凭证是[Object: null prototype]



当我向服务器发送请求时,服务器上我得到一个错误cookie = [Object: null prototype].

<<p>appAPI代码/strong>
...
export const appAPI = createApi({
reducerPath: "appAPI",
baseQuery  : fetchBaseQuery({
baseUrl       : process.env.REACT_APP_API_URL,

凭据:"include">

prepareHeaders: (headers) => {
if (localStorage.getItem("token")) {
headers.set("authorization", `Bearer ${localStorage.getItem("token")}`);
// headers.set("Content-Type", "multipart/form-data");
}
headers.set("Access-Control-Allow-Origin", "https://localhost:3000");
headers.set("Access-Control-Allow-Credentials", "true");
return headers;
},
}),
...

在index.js文件中cors的配置如下所示

app.use(cors({credentials: true, origin: ["http://localhost:3000"]}));

尝试用JSON发送响应。只要res.json({message: "Everything OK"}),我就解决了同样的问题。