Skip to content

Commit

Permalink
fix: response err data: url
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe Yuan committed Apr 12, 2024
1 parent f00e8ff commit 3b0cbc5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libs/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ export const fetchData = async (
res = await fetchApi({ input, init, transOpts, apiSetting });
}

if (!res?.ok) {
if (!res) {
throw new Error("Unknow error");
} else if (!res.ok) {
const msg = {
url: input,
url: res.url,
status: res.status,
};
if (res.headers.get("Content-Type")?.includes("json")) {
Expand Down

0 comments on commit 3b0cbc5

Please sign in to comment.