Compare commits
2 Commits
5d593d593f
...
a9eb1cc684
| Author | SHA1 | Date | |
|---|---|---|---|
| a9eb1cc684 | |||
| 13b563e35e |
@ -449,6 +449,10 @@
|
|||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import AuthService from '../services/AuthService';
|
import AuthService from '../services/AuthService';
|
||||||
const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'https://45.93.137.91.nip.io/api';
|
const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'https://45.93.137.91.nip.io/api';
|
||||||
const REPORT_API_BASE = process.env.NEXT_PUBLIC_REPORT_API_URL || 'http://45.93.137.91/api';
|
const REPORT_API_BASE = process.env.NEXT_PUBLIC_REPORT_API_URL || 'http://45.93.137.91/api';
|
||||||
@ -505,7 +509,13 @@ async function apiFetch(endpoint, options = {}) {
|
|||||||
headers['Content-Type'] = 'application/json';
|
headers['Content-Type'] = 'application/json';
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await fetch(`${API_BASE}${endpoint}`, {
|
const url = `${API_BASE}${endpoint}`;
|
||||||
|
|
||||||
|
console.log('API Request:', url);
|
||||||
|
console.log('API Method:', options.method || 'GET');
|
||||||
|
console.log('API Body:', hasBody ? options.body : null);
|
||||||
|
|
||||||
|
const res = await fetch(url, {
|
||||||
...options,
|
...options,
|
||||||
headers,
|
headers,
|
||||||
body:
|
body:
|
||||||
@ -514,10 +524,13 @@ async function apiFetch(endpoint, options = {}) {
|
|||||||
: options.body,
|
: options.body,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('API Response Status:', res.status);
|
||||||
|
console.log('API Response OK:', res.ok);
|
||||||
assertNotBlocked(res);
|
assertNotBlocked(res);
|
||||||
|
|
||||||
if (!res.ok && res.status !== 206) {
|
if (!res.ok && res.status !== 206) {
|
||||||
const text = await res.text().catch(() => '');
|
const text = await res.text().catch(() => '');
|
||||||
|
console.error('API Error Response:', text || res.statusText);
|
||||||
throw new Error(`API ${res.status}: ${text || res.statusText}`);
|
throw new Error(`API ${res.status}: ${text || res.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1104,7 +1117,7 @@ export async function sendGeneralReport(subject, reportBody) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function submitReport(subject, body) {
|
export async function submitReport(subject, body) {
|
||||||
return apiFetch('/Reports', {
|
return apiFetch('/Reports/SendGeneralReport', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: { subject, body },
|
body: { subject, body },
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user