fix: use credentials:include for cross-origin API requests

This commit is contained in:
M1 2026-03-18 09:44:50 +04:00
parent 641af86779
commit d278ab0458
1 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@ function requireAuth() { return true; }
async function api(path, opts = {}) {
const res = await fetch(`${API_BASE}${path}`, {
...opts,
credentials: 'same-origin', // send cookie automatically
credentials: 'include', // send cookie cross-origin to api.pingql.com
headers: {
'Content-Type': 'application/json',
...opts.headers,
@ -67,7 +67,7 @@ function watchAccount(onPing) {
async function connect() {
try {
const res = await fetch(`${API_BASE}/account/stream`, {
credentials: 'same-origin',
credentials: 'include',
signal: ac.signal,
});
if (!res.ok || !res.body) return;