Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
fix: changed text responses into json responses
Browse files Browse the repository at this point in the history
  • Loading branch information
vycdev committed Jul 13, 2020
1 parent 92616c3 commit 5f1bc82
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/api/src/modules/achievements/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ router.post("/addAchievement", requireAdmin(), async (ctx, next) => {
await addAchievement({ name, description, difficulty, requirements });

ctx.status = 201;
ctx.body = "Successfully added achievement";
ctx.body = { message: "Successfully added achievement" };

await next();
});
Expand All @@ -26,15 +26,15 @@ router.patch("/editAchievement", requireAdmin(), async (ctx, next) => {
throw new HttpError(400, "No achievement with that ID exists");
}
ctx.status = 200;
ctx.body = "Successfully edited achievement";
ctx.body = { message: "Successfully edited achievement" };
await next();
});

router.delete("/deleteAchievement", requireAdmin(), async (ctx, next) => {
const { id } = ctx.request.body;
await deleteAchievement(id);
ctx.status = 200;
ctx.body = "Successfully deleted achievement";
ctx.body = { message: "Successfully deleted achievement" };
await next();
});

Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/modules/auth/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ router.get("/logout", requireAuthenticated(), async (ctx, next) => {
ctx.session = null;

ctx.status = 200;
ctx.body = "Successfully logged out";
ctx.body = { message: "Successfully logged out" };

await next();
});
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/modules/email/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ router.get("/sendVerificationEmail/:userid", async (ctx, next) => {
}

ctx.status = 200;
ctx.body = "Success!";
ctx.body = { message: "Success!" };

await next();
});
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/modules/games/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ router.post(
await removeOldGame(user);
await checkPB(newGame);
ctx.status = 201;
ctx.body = "Successfully created a game!";
ctx.body = { message: "Successfully created a game!" };
await next();
}
);
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/modules/texts/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ router.post(
const { user } = ctx.session!;
await addText(title, text, difficulty, user, ordered, tutorial);
ctx.status = 201;
ctx.body = "Successfully added text";
ctx.body = { message: "Successfully added text" };
await next();
}
);
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/modules/tutorials/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ router.post("/completeTutorial", requireAuthenticated(), async (ctx, next) => {
throw new HttpError(400, "That tutorial does not exist!");
}
ctx.status = 200;
ctx.body = "Successfully completed tutorial";
ctx.body = { message: "Successfully completed tutorial" };
await next();
});

Expand Down

0 comments on commit 5f1bc82

Please sign in to comment.