You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
424 B
15 lines
424 B
|
1 year ago
|
export default eventHandler((event) => {
|
||
|
|
const token = getHeader(event, 'Authorization');
|
||
|
|
|
||
|
|
if (!token) {
|
||
|
|
setResponseStatus(event, 401);
|
||
|
|
return useResponseError('UnauthorizedException', 'Unauthorized Exception');
|
||
|
|
}
|
||
|
|
|
||
|
|
const username = Buffer.from(token, 'base64').toString('utf8');
|
||
|
|
|
||
|
|
const menus =
|
||
|
|
MOCK_MENUS.find((item) => item.username === username)?.menus ?? [];
|
||
|
|
return useResponseSuccess(menus);
|
||
|
|
});
|