refactor(striker-ui-api): rename authenticationHandler->guardApi

main
Tsu-ba-me 2 years ago
parent 9170f78650
commit cbf6ac0ff9
  1. 4
      striker-ui-api/src/app.ts
  2. 2
      striker-ui-api/src/lib/assertAuthentication.ts
  3. 4
      striker-ui-api/src/routes/auth.ts

@ -1,7 +1,7 @@
import cors from 'cors';
import express, { json } from 'express';
import { authenticationHandler } from './lib/assertAuthentication';
import { guardApi } from './lib/assertAuthentication';
import passport from './passport';
import routes from './routes';
import { rrouters } from './lib/rrouters';
@ -21,7 +21,7 @@ app.use(passport.initialize());
app.use(passport.authenticate('session'));
rrouters(app, routes.private, {
assign: (router) => [authenticationHandler, router],
assign: (router) => [guardApi, router],
route: '/api',
});
rrouters(app, routes.public, { route: '/api' });

@ -36,4 +36,4 @@ export const assertAuthentication: (options?: {
};
};
export const authenticationHandler = assertAuthentication();
export const guardApi = assertAuthentication();

@ -1,6 +1,6 @@
import express from 'express';
import { authenticationHandler } from '../lib/assertAuthentication';
import { guardApi } from '../lib/assertAuthentication';
import { login, logout } from '../lib/request_handlers/auth';
import passport from '../passport';
@ -8,6 +8,6 @@ const router = express.Router();
router
.post('/login', passport.authenticate('login'), login)
.put('/logout', authenticationHandler, logout);
.put('/logout', guardApi, logout);
export default router;

Loading…
Cancel
Save