athis-ui/apps/backend-mock/api/auth/logout.post.ts

16 lines
342 B
TypeScript
Raw Permalink Normal View History

2024-11-06 10:35:56 +08:00
import {
clearRefreshTokenCookie,
getRefreshTokenFromCookie,
} from '~/utils/cookie-utils';
export default defineEventHandler(async (event) => {
const refreshToken = getRefreshTokenFromCookie(event);
if (!refreshToken) {
return useResponseSuccess('');
}
clearRefreshTokenCookie(event);
return useResponseSuccess('');
});