14 lines
406 B
TypeScript
14 lines
406 B
TypeScript
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||
|
import { unAuthorizedResponse } from '~/utils/response';
|
||
|
|
||
|
export default eventHandler(async (event) => {
|
||
|
const userinfo = verifyAccessToken(event);
|
||
|
if (!userinfo) {
|
||
|
return unAuthorizedResponse(event);
|
||
|
}
|
||
|
|
||
|
const menus =
|
||
|
MOCK_MENUS.find((item) => item.username === userinfo.username)?.menus ?? [];
|
||
|
return useResponseSuccess(menus);
|
||
|
});
|