I cannot see the cookies using fetch in react but I can see the cookies in thunderclient
<Button
onClick={async () => {
console.log("log bth clk");
const response = await fetch("http://localhost:3000/login", {
mode: "cors",
method: "POST",
headers: {
"Content-Type": "application/json;charset=utf-8",
},
// credentials: "same-origin",
credentials: "include",
body: JSON.stringify({ username, password }),
});
const headers = response.headers;
const json = await response.json();
if (response.status == 400) {
setErrors(json.errors);
} else {
console.log(json, headers, headers.get("a"));
}
// console.log(errors, json);
}}
>
Login
</Button> <Button
onClick={async () => {
console.log("log bth clk");
const response = await fetch("http://localhost:3000/login", {
mode: "cors",
method: "POST",
headers: {
"Content-Type": "application/json;charset=utf-8",
},
// credentials: "same-origin",
credentials: "include",
body: JSON.stringify({ username, password }),
});
const headers = response.headers;
const json = await response.json();
if (response.status == 400) {
setErrors(json.errors);
} else {
console.log(json, headers, headers.get("a"));
}
// console.log(errors, json);
}}
>
Login
</Button>SERVER
res.cookie('a', 1).status(200).json({ msg: "Pass match", accessToken }) res.cookie('a', 1).status(200).json({ msg: "Pass match", accessToken })OUTPUT in image
what am i doing wrong?

