Skip to content

Commit

Permalink
updating GET request
Browse files Browse the repository at this point in the history
  • Loading branch information
aatmanvaidya committed Sep 11, 2023
1 parent 40059a4 commit cf2dede
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 28 deletions.
10 changes: 5 additions & 5 deletions browser-extension/api-server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down
27 changes: 4 additions & 23 deletions browser-extension/plugin/src/ui-components/pages/SlurCreate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: ''
};
Expand Down Expand Up @@ -61,23 +57,8 @@ export function SlurCreate() {
<TextArea name="labelMeaning" />
</FormField>

<FormField name="gender" label="Gender" required>
<RadioButtonGroup name="gender" options={genderOptions} />
</FormField>

<FormField name="religion" label="Religion" required>
<Select name="religion" options={religionOptions} />
</FormField>

<FormField
name="sexualOrientation"
label="Sexual Orientation"
required
>
<Select
name="sexualOrientation"
options={sexualOrientationOptions}
/>
<FormField name="category" label="Category" required>
<Select name="category" options={category} />
</FormField>

<FormField name="appropriated" label="Appropriated" required>
Expand Down

0 comments on commit cf2dede

Please sign in to comment.