Finishing touches to publish
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -2,7 +2,7 @@ import Koa from 'koa';
|
||||
import Router from 'koa-router';
|
||||
import { StatusCodes } from 'http-status-codes';
|
||||
|
||||
import { ROUTE_PREFIX as prefix, RESET_ROUTE } from '../../constants/constants';
|
||||
import { ROUTE_PREFIX as prefix, RESET_ROUTE } from '../../constants/env';
|
||||
import Auth from '../../db/model/auth';
|
||||
import { sign } from '../../utils/jwt';
|
||||
import passport from '../passport';
|
||||
@@ -28,7 +28,7 @@ router.post('/login', async (ctx, next) => {
|
||||
});
|
||||
|
||||
router.post(process.env.RESET_ROUTE || RESET_ROUTE, async (ctx, next) => {
|
||||
const { token = null, password = null } = ctx.request.body as { token?: string, password?: string };
|
||||
const { token = null, password = null } = ctx.request.body as { token?: string; password?: string };
|
||||
if (token && password) {
|
||||
const loginToken = await Auth.resetPassword(token, password).catch();
|
||||
ctx.body({ token: loginToken });
|
||||
@@ -38,13 +38,11 @@ router.post(process.env.RESET_ROUTE || RESET_ROUTE, async (ctx, next) => {
|
||||
});
|
||||
|
||||
router.patch('/:record', (ctx: Koa.Context) => {
|
||||
const data = Auth.findOneAndUpdate(
|
||||
{ record: ctx.params.record },
|
||||
);
|
||||
const data = Auth.findOneAndUpdate({ record: ctx.params.record });
|
||||
if (!data) {
|
||||
ctx.throw(StatusCodes.NOT_FOUND);
|
||||
}
|
||||
ctx.body = { success: true, data };
|
||||
});
|
||||
|
||||
export { router as authRouter };
|
||||
export { router as authRouter };
|
||||
|
||||
Reference in New Issue
Block a user