Skip to main content

User Profile

Route: /profile
File: ayts-fe/app/profile/page.tsx
Auth required: Yes

Purpose

Allows customers to view and update their personal information, manage their delivery address, and view account settings.

Sections

Personal Info

  • First name, last name
  • Email (read-only — managed by Supabase Auth)
  • Phone number
  • Profile picture (avatar upload to R2)

Delivery Addresses

  • Default delivery address
  • Add / edit address
  • Saved addresses list

Account Settings

  • Change password link → /forgot-password
  • Notification preferences (push notifications toggle)

Vendor Info

  • If user has a vendor account: link to vendor dashboard
  • "Apply to sell" link if not a vendor

Data Fetching

// Get profile
GET /api/users/profile

// Update profile
PATCH /api/users/profile
{ firstName, lastName, phone, avatarUrl, defaultLocationId }

// Upload avatar
POST /api/upload/avatar

Profile Picture Upload

Uses the R2 upload flow:

  1. Customer selects image
  2. POST /api/upload/image → returns R2 public URL
  3. PATCH /api/users/profile with avatarUrl: r2Url

Known Issues / Status

ItemStatus
Profile page accessible✅ Working
Profile updates✅ Working
Avatar upload✅ Working
Push notification toggle✅ Working (service worker)
Address management⚠️ Basic — no multi-address support
Full E2E test⚠️ Not yet verified end-to-end
  • Multi-address support (home, work, etc.)
  • Notification history / inbox (no UI currently)
  • Order history shortcut from profile