athis-ui/apps/backend-mock/api/user/info.ts

11 lines
305 B
TypeScript
Raw Permalink Normal View History

2024-11-06 10:35:56 +08:00
import { verifyAccessToken } from '~/utils/jwt-utils';
import { unAuthorizedResponse } from '~/utils/response';
export default eventHandler((event) => {
const userinfo = verifyAccessToken(event);
if (!userinfo) {
return unAuthorizedResponse(event);
}
return useResponseSuccess(userinfo);
});