Skip to content

Add logout button when user is authenticated #43

@Chirag1724

Description

@Chirag1724

Problem

The app has sign in and sign up but no way for users to log out. Once logged in, users can't sign out of their account.

What's Missing?

  • No logout API route
  • No logout button in UI
  • No session cleanup mechanism

Proposed Solution

Add a complete logout flow:

  1. Create logout API endpoint (/api/auth/logout)

    • Delete session from database
    • Clear session cookie
    • Return success response
  2. Add logout button in header/dashboard

    • Show when user is logged in
    • Call logout API
    • Redirect to home page

Implementation Details

New file: src/app/api/auth/logout/route.ts

// Delete session from DB and clear cookie

Metadata

Metadata

Assignees

Labels

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions