Skip to content

Commit 209ff8f

Browse files
committed
feat: add checkIfValidAuthSession method to AccountController and corresponding route
1 parent 579f60c commit 209ff8f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/controllers/account/account.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ export class AccountController {
118118
});
119119
}
120120

121+
static async checkIfValidAuthSession(req: Request, res: Response): Promise<void> {
122+
ensureAuthenticated(req, res, async () => {
123+
res.json({
124+
message: 'Valid auth session'
125+
});
126+
});
127+
}
128+
121129
static async getManyPublic(req: Request, res: Response): Promise<void> {
122130
const getManyPublicSchema = Joi.object({
123131
page: Joi.number().integer().min(1).optional(),

src/routes/auth.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ router.post('/login', authenticate);
1212
router.post('/logout', logout);
1313

1414
router.get('/me', asyncHandler(AccountController.getLoggedInAccount));
15+
router.get('/check-session', asyncHandler(AccountController.checkIfValidAuthSession));
1516

1617
export const authRouter = router;

0 commit comments

Comments
 (0)