athis-ui/apps/backend-mock/api/auth/logout.post.ts
2024-11-06 10:35:56 +08:00

16 lines
342 B
TypeScript

import {
clearRefreshTokenCookie,
getRefreshTokenFromCookie,
} from '~/utils/cookie-utils';
export default defineEventHandler(async (event) => {
const refreshToken = getRefreshTokenFromCookie(event);
if (!refreshToken) {
return useResponseSuccess('');
}
clearRefreshTokenCookie(event);
return useResponseSuccess('');
});