fix https error

This commit is contained in:
2025-12-07 20:55:17 +03:00
parent baed0706a6
commit b8f54f9871
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -1,7 +1,9 @@
// api.js
export async function apiRequest(url, payload = {}, method = 'POST') {
const res = await fetch(url, {
method: method,
const finalUrl = new URL(url, window.location.origin).toString();
const res = await fetch(finalUrl, {
method,
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
@@ -14,5 +16,6 @@ export async function apiRequest(url, payload = {}, method = 'POST') {
const text = await res.text();
throw new Error(`HTTP ${res.status}: ${text}`);
}
return res.json();
}
+1 -1
View File
@@ -23,7 +23,7 @@ export async function setCookie(name, value, days = 180) {
}
}
const secure = false; // TODO включить после тестов
const secure = true; // TODO включить после тестов
const sameSite = 'Lax';
const expires = new Date(Date.now() + days * 864e5).toUTCString();