refactor: webapi http

This commit is contained in:
手瓜一十雪 2024-05-13 21:22:20 +08:00
parent 8fe7d3aaec
commit 7ecd479b3e
2 changed files with 7 additions and 2 deletions

View File

@ -61,7 +61,12 @@ export class RequestUtil {
requestInit.headers = new Headers(headers);
}
try {
const response = await fetch(url, { ...requestInit, body: data });
let response;
if (method.toUpperCase() === 'POST') {
response = await fetch(url, { ...requestInit, body: data });
} else {
response = await fetch(url, { ...requestInit });
}
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}

@ -1 +1 @@
Subproject commit d06dd4d66ca4d50c70ce066cd872edb939138d34
Subproject commit f88118be512b1ed1537b2aad1f183c04858e1d70