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.
|
|
|
|
import { eventHandler } from 'h3';
|
|
|
|
|
import { verifyAccessToken } from '~/utils/jwt-utils';
|
|
|
|
|
import { MOCK_CODES } from '~/utils/mock-data';
|
|
|
|
|
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
|
|
|
|
|
|
|
|
|
export default eventHandler((event) => {
|
|
|
|
|
const userinfo = verifyAccessToken(event);
|
|
|
|
|
if (!userinfo) {
|
|
|
|
|
return unAuthorizedResponse(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const codes =
|
|
|
|
|
MOCK_CODES.find((item) => item.username === userinfo.username)?.codes ?? [];
|
|
|
|
|
|
|
|
|
|
return useResponseSuccess(codes);
|
|
|
|
|
});
|