From 678405b619934b43c4142de0c7a97d23a774a754 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 3 Dec 2024 15:21:25 +0100 Subject: [PATCH] fix --- src/pages/nutrition/utils.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/pages/nutrition/utils.ts b/src/pages/nutrition/utils.ts index 42892a9cc5..73367a247c 100644 --- a/src/pages/nutrition/utils.ts +++ b/src/pages/nutrition/utils.ts @@ -61,12 +61,16 @@ export function postRobotoff(config: PostRobotoffParams) { axios.post( `${ROBOTOFF_API_URL}/insights/annotate`, + new URLSearchParams( + `insight_id=${insightId}&annotation=2&data=${JSON.stringify({ + nutrients: filteredValues, + })}`, + ), { - insight_id: insightId, - annotation: 2, - data: { nutrient: filteredValues }, + withCredentials: true, + + headers: { "content-type": "application/x-www-form-urlencoded" }, }, - { withCredentials: true }, ); } @@ -75,10 +79,7 @@ export function skipRobotoff(config: Pick) { axios.post( `${ROBOTOFF_API_URL}/insights/annotate`, - { - insight_id: insightId, - annotation: -1, - }, + new URLSearchParams(`insight_id=${insightId}&annotation=-1`), { withCredentials: true }, ); } @@ -88,10 +89,7 @@ export function deleteRobotoff(config: Pick) { axios.post( `${ROBOTOFF_API_URL}/insights/annotate`, - { - insight_id: insightId, - annotation: 0, - }, + new URLSearchParams(`insight_id=${insightId}&annotation=0`), { withCredentials: true }, ); }