fix/ui-1.0.0:api fetch error need to throw
This commit is contained in:
1 parent
31e3b6b0a8
commit
49627d2449
1 file changed
+6
-7
@@ -54,12 +54,11 @@ export const fetchAPI = async <T = any>(
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("API fetch error:", error);
|
||||
return {
|
||||
success: false,
|
||||
code: "ERROR",
|
||||
error_message: error instanceof Error ? error.message : "Unknown error",
|
||||
data: null as T,
|
||||
};
|
||||
if (error instanceof Error && error.name === "AbortError") {
|
||||
console.log("Request aborted:", url);
|
||||
} else {
|
||||
console.error("Fetch error:", error);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user