uniform authuser

This commit is contained in:
archer
2023-05-21 10:52:51 +08:00
parent bd9d83e630
commit e45c1eb1e0
41 changed files with 173 additions and 128 deletions

View File

@@ -2,7 +2,7 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import { jsonRes } from '@/service/response';
import { connectToDatabase, Bill } from '@/service/mongo';
import { authToken } from '@/service/utils/auth';
import { authUser } from '@/service/utils/auth';
import type { BillSchema } from '@/types/mongoSchema';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
@@ -12,7 +12,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
pageNum = +pageNum;
pageSize = +pageSize;
const userId = await authToken(req);
const { userId } = await authUser({ req, authToken: true });
await connectToDatabase();