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:
parent
b623f806d8
commit
f52054e5e2
1 changed files with 3 additions and 3 deletions
|
|
@ -25,7 +25,7 @@ export function AuthGate({ children }: Props) {
|
|||
const [loading, setLoading] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
fetch('/cashup/api/auth/verify?app=cashup', { credentials: 'include' })
|
||||
fetch('/api/auth/verify?app=cashup', { credentials: 'include' })
|
||||
.then(async r => {
|
||||
if (r.ok) { setUser(await r.json()); setState('authed') }
|
||||
else setState('login')
|
||||
|
|
@ -38,13 +38,13 @@ export function AuthGate({ children }: Props) {
|
|||
setLoading(true)
|
||||
setError('')
|
||||
try {
|
||||
const res = await fetch('/cashup/api/auth/login', {
|
||||
const res = await fetch('/api/auth/login', {
|
||||
method: 'POST', credentials: 'include',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ email, password }),
|
||||
})
|
||||
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') }
|
||||
else setError("You don't have access to this app.")
|
||||
} catch {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue