diff --git a/apps/web/src/components/dev/DevLogin.tsx b/apps/web/src/components/dev/DevLogin.tsx index f3d3dca..14152a8 100644 --- a/apps/web/src/components/dev/DevLogin.tsx +++ b/apps/web/src/components/dev/DevLogin.tsx @@ -7,14 +7,14 @@ import { apiFetch } from '../../lib/api-client'; import { authStore } from '../../lib/auth-store'; import { AuthTokenResponseSchema } from '@sar/api-interface'; -type DevUser = { userId: string; role: string; label: string }; +type DevUser = { key: string; userId: string; role: string; label: string }; // userId = cod_vendedor como string; idEmpresa = empresa no ERP (dev default = 1) // Em dev, o backend força DEV_REP_CODE=29 independente do userId enviado. const DEV_USERS: DevUser[] = [ - { userId: '29', role: 'rep', label: 'PAVEI COMERCIO (cod 29)' }, - { userId: '29', role: 'supervisor', label: 'PAVEI — Supervisor (cod 29)' }, - { userId: '29', role: 'manager', label: 'PAVEI — Gerente (cod 29)' }, + { key: 'rep-29', userId: '29', role: 'rep', label: 'PAVEI COMERCIO (cod 29)' }, + { key: 'sup-29', userId: '29', role: 'supervisor', label: 'PAVEI — Supervisor (cod 29)' }, + { key: 'mgr-29', userId: '29', role: 'manager', label: 'PAVEI — Gerente (cod 29)' }, ]; export function DevLogin({ onLogin }: { onLogin: () => void }) { @@ -22,7 +22,7 @@ export function DevLogin({ onLogin }: { onLogin: () => void }) { const [error, setError] = useState(null); async function handleLogin(user: DevUser) { - setLoading(user.userId); + setLoading(user.key); setError(null); try { const raw = await apiFetch('/auth/dev/token', { @@ -42,24 +42,24 @@ export function DevLogin({ onLogin }: { onLogin: () => void }) { return ( - + SAR · Login Dev - {error && } + {error && } Entrar como {DEV_USERS.map((u) => (