From 7161b3772eef99fe9f1d8011a50fb3278e3c5e04 Mon Sep 17 00:00:00 2001 From: moe-music Date: Fri, 1 Sep 2023 16:00:18 +0530 Subject: [PATCH] new --- src/api/routes/auth/AuthRouter.ts | 6 ++++++ src/api/routes/guilds/GuildRouter.ts | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/api/routes/auth/AuthRouter.ts b/src/api/routes/auth/AuthRouter.ts index 8ec893a52..29b6296a3 100644 --- a/src/api/routes/auth/AuthRouter.ts +++ b/src/api/routes/auth/AuthRouter.ts @@ -13,6 +13,12 @@ class AuthRouter { this.router.get("/login", passport.authenticate("discord"), (req, res) => { res.sendStatus(200); }); + this.router.get("/logout", (req, res, next) => { + req.logout(function (err) { + if (err) { return next(err); } + res.redirect(`${config.dashboard.website}/`); + }); + }); this.router.get("/redirect", passport.authenticate("discord"), (req, res) => { res.redirect(`${config.dashboard.website}/dashboard`); }); diff --git a/src/api/routes/guilds/GuildRouter.ts b/src/api/routes/guilds/GuildRouter.ts index 76aa66d00..f57c88b70 100644 --- a/src/api/routes/guilds/GuildRouter.ts +++ b/src/api/routes/guilds/GuildRouter.ts @@ -13,7 +13,7 @@ class GuildRouter { private initializeRoutes() { this.router.get("/:id", IsAuth, this.getGuild); this.router.get("/:id/members", IsAuth, this.getGuildsMembers); - this.router.post("/:id/prefix", IsAuth, this.updateGuildPrefix); + this.router.put("/:id/prefix", IsAuth, this.updateGuildPrefix); } private async getGuild(req: Request, res: Response) { const guild = await getGuild(req.params.id); @@ -25,7 +25,6 @@ class GuildRouter { } private async updateGuildPrefix(req: Request, res: Response) { - console.log(req.params.id, req.body.prefix); await ServerData.setPrefix(req.params.id, req.body.prefix); return res.sendStatus(200); }