refactor: webapi http

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

No files matched your search

+6 -1
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}`);
}
Submodule src/core updated: d06dd4d66c...f88118be51.