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.
19 lines
563 B
19 lines
563 B
import { logoutUser } from "#server/service/auth";
|
|
import { getSessionId, clearSessionCookie } from "#server/service/auth/cookie";
|
|
import { toPublicAuthError } from "#server/service/auth/errors";
|
|
|
|
export default defineWrappedResponseHandler(async (event) => {
|
|
try {
|
|
const sessionId = getSessionId(event);
|
|
if (sessionId) {
|
|
await logoutUser(sessionId);
|
|
}
|
|
clearSessionCookie(event);
|
|
|
|
return R.success({
|
|
success: true,
|
|
});
|
|
} catch (err) {
|
|
throw toPublicAuthError(err);
|
|
}
|
|
});
|
|
|