Skip to content

Commit

Permalink
Fix missing parameter in language update route
Browse files Browse the repository at this point in the history
  • Loading branch information
xuelink committed Apr 4, 2024
1 parent f5c6cee commit 322ac49
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/controllers/language.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export default class LanguageController {
try {
console.log("update language");
throwIfMissing(req.headers, ["x-appwrite-user-id", "x-appwrite-jwt"]);
throwIfMissing(req.params, ["id"]);
if (!req.body || Object.keys(req.body).length === 0) {
console.log("Request body is empty.");
return res
Expand All @@ -116,8 +117,8 @@ export default class LanguageController {
const jwt: string = req.headers["x-appwrite-jwt"] as string;

// Set data to variables
const id: string = req.body.id;
const data: any = req.body.data;
const id: string = req.params.id;
const data: any = req.body;

const disallowedFields = ["userId"];

Expand Down
2 changes: 1 addition & 1 deletion src/routes/language.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class MessageRoutes {

intializeRoutes() {
this.router.post("/", this.controller.create);
this.router.patch("/", this.controller.update);
this.router.patch("/:id", this.controller.update);
}
}

Expand Down

0 comments on commit 322ac49

Please sign in to comment.