diff --git a/website/src/pages/api/set_label.ts b/website/src/pages/api/set_label.ts index 7ea589b0..970e1687 100644 --- a/website/src/pages/api/set_label.ts +++ b/website/src/pages/api/set_label.ts @@ -13,22 +13,10 @@ const handler = async (req, res) => { res.status(401).end(); return; } - console.log(JSON.parse(req.body)); - // Parse out the local task ID and the interaction contents. - const { post_id, label_map, text } = await JSON.parse(req.body); - console.log(JSON.stringify( - { - "type": "text_labels", - "message_id": post_id, - "labels": label_map, - "text": text, - "user": { - "id": token.sub, - "display_name": token.name || token.email, - "auth_method": "local", - }})); - console.log("Here sending text_labels1..."); - // Send the interaction to the Text Label to the Backend. + + // Parse out the local message_id, task ID and the interaction contents. + const { message_id, post_id, label_map, text } = await JSON.parse(req.body); + const interactionRes = await fetch(`${process.env.FASTAPI_URL}/api/v1/text_labels`, { method: "POST", headers: { @@ -37,7 +25,7 @@ const handler = async (req, res) => { }, body: JSON.stringify({ "type": "text_labels", - "message_id": post_id, + "message_id": message_id, "labels": label_map, "text": text, "user": { @@ -48,7 +36,6 @@ const handler = async (req, res) => { }), }); - console.log(interactionRes); res.status(interactionRes.status).json(interactionRes.json()); };