From 939c7b4621fc9cdb6d6e749c4d361944eea14e33 Mon Sep 17 00:00:00 2001 From: saravanakumardb1 Date: Sun, 31 May 2026 01:21:58 -0700 Subject: [PATCH] fix(tracker-web): include productId in login (LoginSchema requires it) The login form posted {email,password} but platform-service LoginSchema requires productId, so real logins returned 400 (only the mocked e2e passed). Send the selected product (tracker_selected_product) or the default PRODUCT_ID. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- dashboards/tracker-web/src/lib/auth-context.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dashboards/tracker-web/src/lib/auth-context.tsx b/dashboards/tracker-web/src/lib/auth-context.tsx index 730ab4d4..ca7d1313 100644 --- a/dashboards/tracker-web/src/lib/auth-context.tsx +++ b/dashboards/tracker-web/src/lib/auth-context.tsx @@ -1,6 +1,7 @@ 'use client'; import { createContext, useContext, useState, useEffect, useCallback, type ReactNode } from 'react'; +import { PRODUCT_ID } from './product-constants'; interface User { id: string; @@ -54,10 +55,15 @@ export function AuthProvider({ children }: { children: ReactNode }) { }, []); const login = useCallback(async (email: string, password: string) => { + // platform-service LoginSchema requires productId — use the selected product + // (set by the product switcher) or fall back to the default product. + const productId = + (typeof window !== 'undefined' && localStorage.getItem('tracker_selected_product')) || + PRODUCT_ID; const res = await fetch('/api/auth/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ email, password }), + body: JSON.stringify({ email, password, productId }), }); if (!res.ok) { const body = await res.json().catch(() => ({}));