implemented logging
This commit is contained in:
@ -8,6 +8,8 @@ import { authOptions } from "../auth/[...nextauth]";
|
||||
const common = require("../../../src/helpers/common");
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { decode } from 'next-auth/jwt';
|
||||
const logger = require('../../../src/logger');
|
||||
|
||||
// import { getToken } from "next-auth/jwt";
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
@ -25,6 +27,14 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const authHeader = req.headers.authorization || '';
|
||||
//console.log('authHeader', authHeader);
|
||||
if (session) {
|
||||
//get target table
|
||||
const targetTable = req.query.nextcrud[0];
|
||||
//get target action
|
||||
if (req.method === 'DELETE') {
|
||||
|
||||
const targetId = req.query.nextcrud[1];
|
||||
logger.info('[nextCrud] ' + targetTable + ': ' + targetId + 'DELETED by ' + session.user.email);
|
||||
}
|
||||
return nextCrudHandler(req, res);
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user