mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-30 10:28:42 +00:00
22 lines
667 B
TypeScript
22 lines
667 B
TypeScript
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
import { jsonRes } from '@fastgpt/service/common/response';
|
|
import { authCert } from '@fastgpt/service/support/permission/auth/common';
|
|
import { connectToDatabase } from '@/service/mongo';
|
|
import { getUserDetail } from '@fastgpt/service/support/user/controller';
|
|
|
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
try {
|
|
await connectToDatabase();
|
|
const { tmbId } = await authCert({ req, authToken: true });
|
|
|
|
jsonRes(res, {
|
|
data: await getUserDetail({ tmbId })
|
|
});
|
|
} catch (err) {
|
|
jsonRes(res, {
|
|
code: 500,
|
|
error: err
|
|
});
|
|
}
|
|
}
|