WOOHOO
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user