Skip to content

Commit

Permalink
fix get kcal api call
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-iaco committed Nov 1, 2024
1 parent 1c4ff97 commit 93f38df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/api/itemApis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export const deleteItem = async (id: string, pantryId: string, controller: Abort
}

export const getFoodKcal = async (foodId: string, quantity: number, pantryId: string, controller: AbortController) => {
const url = `${baseUrl}/item/${foodId}/kcal?quantity=${quantity}?pantryId=${pantryId}`;
const url = `${baseUrl}/item/${foodId}/kcal?quantity=${quantity}&pantryId=${pantryId}`;
const token = await getFirebaseUserToken()
const axiosResponse = await axios.get(url, {
headers: {
Expand Down
4 changes: 2 additions & 2 deletions src/component/CompleteFoodConsumptionComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const CompleteFoodConsumptionComponent = (props: StepperComponentProps) => {
const [unit, setUnit] = useState("");
const [quantityGram, setQuantityGram] = useState<number>(0);
const [kcals, setKcals] = useState<number>(0);
const [cost, setCost] = useState<number>(0);
const [cost, setCost] = useState<number>(currentTransaction?.price || 0);

const navigate = useNavigate();
const dispatch = useDispatch();
Expand Down Expand Up @@ -68,7 +68,7 @@ const CompleteFoodConsumptionComponent = (props: StepperComponentProps) => {
unit={currentTransaction ? currentTransaction.unit : unit}
quantityGram={quantityGram}
kcals={kcals}
cost={currentFood ? undefined : cost}
cost={cost}
onFoodNameChanged={setFoodName}
onQuantityChanged={setQuantity}
onUnitChanged={setUnit}
Expand Down

0 comments on commit 93f38df

Please sign in to comment.