abdullahalioo commited on
Commit
e692534
·
verified ·
1 Parent(s): e021e29

Update static/js/main.js

Browse files
Files changed (1) hide show
  1. static/js/main.js +3 -2
static/js/main.js CHANGED
@@ -83,16 +83,17 @@ async function apiRequest(url, options = {}) {
83
  try {
84
  const response = await fetch(url, {
85
  ...options,
 
86
  headers: {
87
  'Content-Type': 'application/json',
88
  ...options.headers
89
  }
90
  });
91
-
92
  if (!response.ok) {
93
  throw new Error(`HTTP error! status: ${response.status}`);
94
  }
95
-
96
  return await response.json();
97
  } catch (error) {
98
  console.error('API request failed:', error);
 
83
  try {
84
  const response = await fetch(url, {
85
  ...options,
86
+ credentials: 'include', // ✅ This is the key fix
87
  headers: {
88
  'Content-Type': 'application/json',
89
  ...options.headers
90
  }
91
  });
92
+
93
  if (!response.ok) {
94
  throw new Error(`HTTP error! status: ${response.status}`);
95
  }
96
+
97
  return await response.json();
98
  } catch (error) {
99
  console.error('API request failed:', error);