refactor(server:consume): change so error returns 200 so we can see the true error
This commit is contained in:
@@ -27,7 +27,7 @@ export const consumeMaterial = async (data: Data, prod: any) => {
|
|||||||
if (barcode.length === 0) {
|
if (barcode.length === 0) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
message: "The running number provided is not in stock please check if stock and try again.",
|
message: "The running number you've is not in stock.",
|
||||||
};
|
};
|
||||||
//throw Error("The provided runningNr is not in stock");
|
//throw Error("The provided runningNr is not in stock");
|
||||||
}
|
}
|
||||||
@@ -49,6 +49,6 @@ export const consumeMaterial = async (data: Data, prod: any) => {
|
|||||||
//console.log(results);
|
//console.log(results);
|
||||||
return {success: true, message: "Material was consumed", status: results.status};
|
return {success: true, message: "Material was consumed", status: results.status};
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
return {success: false, status: error.response?.status, message: error.response?.data.errors[0].message};
|
return {success: false, status: 200, message: error.response?.data.errors[0].message};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user