2024-08-19 14:59:42 +00:00
|
|
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
|
|
|
import { unAuthorizedResponse } from '~/utils/response';
|
|
|
|
|
2024-07-20 00:31:05 +00:00
|
|
|
export default eventHandler((event) => {
|
2024-08-19 14:59:42 +00:00
|
|
|
const userinfo = verifyAccessToken(event);
|
|
|
|
if (!userinfo) {
|
|
|
|
return unAuthorizedResponse(event);
|
2024-07-20 00:31:05 +00:00
|
|
|
}
|
2024-08-19 14:59:42 +00:00
|
|
|
return useResponseSuccess(userinfo);
|
2024-07-20 00:31:05 +00:00
|
|
|
});
|