From cf2dede2f42f0247c44f527211e6a7bef6839cb7 Mon Sep 17 00:00:00 2001 From: Aatman Vaidya Date: Mon, 11 Sep 2023 17:33:43 +0530 Subject: [PATCH] updating GET request --- browser-extension/api-server/index.js | 10 +++---- .../src/ui-components/pages/SlurCreate.jsx | 27 +++---------------- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/browser-extension/api-server/index.js b/browser-extension/api-server/index.js index f6d9c81d..50f177f8 100644 --- a/browser-extension/api-server/index.js +++ b/browser-extension/api-server/index.js @@ -62,7 +62,6 @@ app.post("/preference/", async (req, res) => { // Feedback code from here - app.post("/feedback", async (req, res) => { console.log("POST feedback"); try { @@ -210,15 +209,16 @@ app.get("/slur", async (req, res) => { }, include: [ { - model: category, as: "categories", + model: category, + as: "categories", }, ], }); - if (results.length === 0) { - res.status(404).send(); + if (results) { + res.status(500).send({ error: "error finding slurs" }); } else { - res.send(results); + res.json(results); } } catch (error) { console.error(error); diff --git a/browser-extension/plugin/src/ui-components/pages/SlurCreate.jsx b/browser-extension/plugin/src/ui-components/pages/SlurCreate.jsx index e0a4d453..d6b26f12 100644 --- a/browser-extension/plugin/src/ui-components/pages/SlurCreate.jsx +++ b/browser-extension/plugin/src/ui-components/pages/SlurCreate.jsx @@ -13,18 +13,14 @@ import { } from 'grommet'; import { useNavigate } from 'react-router-dom'; -const genderOptions = ['a', 'b', 'c']; -const religionOptions = ['Option 1', 'Option 2', 'Option 3']; -const sexualOrientationOptions = ['Option A', 'Option B', 'Option C']; +const category = ['gender', 'religion', 'caste']; const appropriatedOptions = [true, false]; export function SlurCreate() { const initialFormData = { label: '', labelMeaning: '', - gender: '', - religion: '', - sexualOrientation: '', + category: '', appropriated: false, appropriationContext: '' }; @@ -61,23 +57,8 @@ export function SlurCreate() {