export default defineEventHandler(async (event) => {
  try {
    const cleared = await clearUserSession(event)
    if (!cleared) {
      console.warn('Failed to clear user session')
    }
  } catch (error) {
    console.error('Error clearing user session:', error)
  }

  return sendRedirect(event, '/login', 200)
})
