From 630da41536328d33998cade836e95de02ada83e0 Mon Sep 17 00:00:00 2001 From: Filip Rojek Date: Sun, 12 May 2024 17:47:06 +0200 Subject: [PATCH] Fix: check that beer was added --- frontend/app/(app)/(tabs)/beer/add.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/app/(app)/(tabs)/beer/add.js b/frontend/app/(app)/(tabs)/beer/add.js index b9629e4..aeb0dd7 100644 --- a/frontend/app/(app)/(tabs)/beer/add.js +++ b/frontend/app/(app)/(tabs)/beer/add.js @@ -46,8 +46,8 @@ export default function BeerAdd() { }); const res = await req.json(); - if (res.success & res.new_beer_id) { - window.location.href = `/beer/${res.new_beer_id}`; + if (res.code == 201 && res.data._id) { + window.location.href = `/beer/${res.data._id}`; } else { alert( "Beer was not added successfully. Please check your data and try again.",