fix: AuthGate stuck on Loading — verify returns flat user object
The auth /verify endpoint returns { user_id, name, email, is_admin, caps }
directly, not wrapped in a user key, so data.user was undefined and the
gate never rendered. Also: caps come back as bare slugs when ?app= is
passed, so the prefixed room-planner:cap checks always failed — replaced
with the standard can(user, cap) helper honouring is_admin.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2993dfa216
commit
5a2dab637c
5 changed files with 14 additions and 7 deletions
|
|
@ -24,7 +24,7 @@ export default function AuthGate({ children }: { children: React.ReactNode }) {
|
|||
if (!r.ok) throw new Error(`Auth check failed: ${r.status}`)
|
||||
return r.json()
|
||||
})
|
||||
.then(data => { if (data) setUser(data.user) })
|
||||
.then(data => { if (data) setUser(data) })
|
||||
.catch(err => setError(err.message))
|
||||
}, [])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue