Fix: check that beer was added
This commit is contained in:
parent
674ee65c29
commit
630da41536
@ -46,8 +46,8 @@ export default function BeerAdd() {
|
|||||||
});
|
});
|
||||||
const res = await req.json();
|
const res = await req.json();
|
||||||
|
|
||||||
if (res.success & res.new_beer_id) {
|
if (res.code == 201 && res.data._id) {
|
||||||
window.location.href = `/beer/${res.new_beer_id}`;
|
window.location.href = `/beer/${res.data._id}`;
|
||||||
} else {
|
} else {
|
||||||
alert(
|
alert(
|
||||||
"Beer was not added successfully. Please check your data and try again.",
|
"Beer was not added successfully. Please check your data and try again.",
|
||||||
|
Loading…
Reference in New Issue
Block a user