fix: openapi key unsave

This commit is contained in:
archer 2023-05-08 11:13:20 +08:00
parent d807f9d097
commit d351084688
No known key found for this signature in database
GPG Key ID: 569A5660D2379E28
2 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
const userId = await authToken(req);
await connectToDatabase();
// 更新对应的记录
await User.updateOne(
{
@ -22,7 +21,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
},
{
...(avatar && { avatar }),
...(openaiKey && { openaiKey })
...(openaiKey !== undefined && { openaiKey })
}
);

View File

@ -61,6 +61,7 @@ const NumberSetting = () => {
maxH: 60
});
onclickSave({
...userInfo,
avatar: base64
});
} catch (err: any) {
@ -70,7 +71,7 @@ const NumberSetting = () => {
});
}
},
[onclickSave, toast]
[onclickSave, toast, userInfo]
);
const onclickLogOut = useCallback(() => {