Fix auth calls to use central auth routes

AuthGate was calling /cashup/api/auth/verify and /cashup/api/auth/login,
which hit the cashup backend (404). Should call /api/auth/* which NPM
routes to the central auth service, matching all other apps.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-01 21:13:04 +00:00
parent b623f806d8
commit f52054e5e2

View file

@ -25,7 +25,7 @@ export function AuthGate({ children }: Props) {
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
useEffect(() => { useEffect(() => {
fetch('/cashup/api/auth/verify?app=cashup', { credentials: 'include' }) fetch('/api/auth/verify?app=cashup', { credentials: 'include' })
.then(async r => { .then(async r => {
if (r.ok) { setUser(await r.json()); setState('authed') } if (r.ok) { setUser(await r.json()); setState('authed') }
else setState('login') else setState('login')
@ -38,13 +38,13 @@ export function AuthGate({ children }: Props) {
setLoading(true) setLoading(true)
setError('') setError('')
try { try {
const res = await fetch('/cashup/api/auth/login', { const res = await fetch('/api/auth/login', {
method: 'POST', credentials: 'include', method: 'POST', credentials: 'include',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, password }), body: JSON.stringify({ email, password }),
}) })
if (!res.ok) { setError('Invalid email or password'); return } if (!res.ok) { setError('Invalid email or password'); return }
const verify = await fetch('/cashup/api/auth/verify?app=cashup', { credentials: 'include' }) const verify = await fetch('/api/auth/verify?app=cashup', { credentials: 'include' })
if (verify.ok) { setUser(await verify.json()); setState('authed') } if (verify.ok) { setUser(await verify.json()); setState('authed') }
else setError("You don't have access to this app.") else setError("You don't have access to this app.")
} catch { } catch {