Skip to content

Commit

Permalink
Merge branch 'refs/heads/backend'
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 6, 2024
2 parents 24a4050 + c05eeaf commit ecbb9fc
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
13 changes: 13 additions & 0 deletions backend/dist/controllers/user.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ class Controller extends rootController_1.default {
data: null,
});
}));
this.logout = this.catchAsync((req, res) => __awaiter(this, void 0, void 0, function* () {
res.clearCookie("tmAccessToken", {
httpOnly: true,
sameSite: "none",
secure: true,
});
this.apiResponse(res, {
statusCode: http_status_1.default.OK,
success: true,
message: "Logout successful",
data: null,
});
}));
}
}
exports.UserController = new Controller();
1 change: 1 addition & 0 deletions backend/dist/routes/user.route.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ router.get("/", user_controller_1.UserController.getAllUsers);
router.get("/auth", auth_1.default, user_controller_1.UserController.auth);
router.patch("/update/:id", (0, validateRequest_1.default)(user_validation_1.UserValidationSchema.updateZodSchema), user_controller_1.UserController.updateUser);
router.post("/login", (0, validateRequest_1.default)(user_validation_1.UserValidationSchema.loginZodSchema), user_controller_1.UserController.login);
router.delete("/logout", user_controller_1.UserController.logout);
exports.UserRoutes = router;
13 changes: 13 additions & 0 deletions backend/src/controllers/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ class Controller extends RootController {
data: null,
});
});
logout = this.catchAsync(async (req: Request, res: Response) => {
res.clearCookie("tmAccessToken", {
httpOnly: true,
sameSite: "none",
secure: true,
});
this.apiResponse(res, {
statusCode: httpStatus.OK,
success: true,
message: "Logout successful",
data: null,
});
});
}

export const UserController = new Controller();
2 changes: 2 additions & 0 deletions backend/src/routes/user.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ router.post(
UserController.login
);

router.delete("/logout", UserController.logout);

export const UserRoutes = router;

0 comments on commit ecbb9fc

Please sign in to comment.