refactor: scipt and request

This commit is contained in:
手瓜一十雪
2024-05-14 10:16:30 +08:00
parent f64fb861a1
commit 8b633c1361
4 changed files with 14 additions and 11 deletions

View File

@@ -63,9 +63,10 @@ export class RequestUtil {
try {
let response;
if (method.toUpperCase() === 'POST') {
response = await fetch(url, { ...requestInit, body: data });
//console.log({ method: 'POST', ...requestInit, body: data });
response = await fetch(url, { method: 'POST', ...requestInit, body: data });
} else {
response = await fetch(url, { ...requestInit });
response = await fetch(url, { method: method, ...requestInit });
}
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);