perf: 账号api结构

This commit is contained in:
archer
2023-04-07 20:58:41 +08:00
parent d5923bc64f
commit 9b18a46456
6 changed files with 35 additions and 116 deletions

View File

@@ -9,7 +9,7 @@ import { UserUpdateParams } from '@/types/user';
/* 更新一些基本信息 */
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
try {
const { accounts } = req.body as UserUpdateParams;
const { openaiKey } = req.body as UserUpdateParams;
const { authorization } = req.headers;
if (!authorization) {
@@ -26,8 +26,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
_id: userId
},
{
// 限定字段
...(accounts ? { accounts } : {})
openaiKey
}
);