From cdc5970b3a1ca7985253e01a75c7d9050658a244 Mon Sep 17 00:00:00 2001 From: Filip Rojek Date: Thu, 2 May 2024 01:19:44 +0200 Subject: [PATCH] Added: api auth status --- api/src/routes/api_v1.ts | 29 ++--------------------------- api/tests/auth.test.ts | 4 +--- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/api/src/routes/api_v1.ts b/api/src/routes/api_v1.ts index c8a3855..fcfb6c7 100644 --- a/api/src/routes/api_v1.ts +++ b/api/src/routes/api_v1.ts @@ -2,38 +2,13 @@ import { Router } from "express"; import * as authController from "../controllers/authController"; import validate from '../middlewares/validateRequest' import * as AuthVal from '../validators/authValidator' -//import handleValidation from "../middlewares/handleValidation"; import { requireAuth } from "../middlewares/authMiddleware"; const router = Router(); -//const mws = [requireAuth, handleValidation.handleValidationError]; - router.post("/auth/signup",validate(AuthVal.signup) , authController.signup_post); router.post("/auth/signin",validate(AuthVal.signin) , authController.signin_post); router.post("/auth/logout", requireAuth, authController.logout_post); +router.get("/auth/status", requireAuth, authController.status_get); -//router.post( -// "/login", -// authValidator.checkUserLogin(), -// handleValidation.handleValidationError, -// userController.login_post -//); - -//router.post( -// "/register", -// authValidator.checkUserRegister(), -// handleValidation.handleValidationError, -// userController.register_post -//); - -//router.post("/logout", userController.logout_post); - -//router.post( -// "/edit", -// [requireAuth], -// authValidator.checkChange(), -// userController.edit_post -//); - -export default router; +export default router; \ No newline at end of file diff --git a/api/tests/auth.test.ts b/api/tests/auth.test.ts index 95d8d82..b736146 100644 --- a/api/tests/auth.test.ts +++ b/api/tests/auth.test.ts @@ -207,7 +207,6 @@ describe('POST /api/v1/auth/logout', () => { }); }); -/* describe('GET /api/v1/auth/status', () => { const url = '/api/v1/auth/status'; test('should return login status 401', async () => { @@ -219,5 +218,4 @@ describe('GET /api/v1/auth/status', () => { const res = await request.get(url).set('Cookie', jwt).send(); expect(res.statusCode).toBe(200); }); -}); -*/ +}); \ No newline at end of file