This commit is contained in:
NotII
2025-03-14 17:03:54 +00:00
parent 87a58a6736
commit 0c64b5be79
5 changed files with 183 additions and 51 deletions

View File

@@ -47,6 +47,12 @@ export const addShippingMethod = async (
}
);
// If fetchData returns directly (not a Response object), just return it
if (!res.ok && !res.status) {
return res;
}
// Handle if it's a Response object
if (!res.ok) {
const errorData = await res.json();
throw new Error(errorData.message || "Failed to add shipping method");
@@ -102,7 +108,7 @@ export const updateShippingMethod = async (
);
if (!res) throw new Error("Failed to update shipping method");
return res
return res;
} catch (error) {
console.error("Error updating shipping method:", error);
throw error;