export default function handler(req, res) {
  if (req.method !== 'POST') {
    return res.status(405).json({ message: 'Method not allowed' });
  }

  try {
    // Cookie serverseitig löschen
    res.setHeader('Set-Cookie', [
      'isAuthenticated=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; SameSite=Strict'
    ]);
    
    res.status(200).json({ message: 'Logout successful' });
  } catch (error) {
    console.error('Logout API error:', error);
    res.status(500).json({ message: 'Internal server error' });
  }
}