auth-fixes #12
Reference in New Issue
Block a user
No description provided.
Delete Branch "auth-fixes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Wire spec-driven auth into the frontend. Auth config (server URL, paths) is extracted from the served OpenAPI spec by
AppProvider.AuthProviderreceives the config as a prop. 401 responses from both the main API and the auth server dispatch anauth:unauthorizedevent that triggers redirect to/login. FixProfileRoutesURL duplication bug.Changes
Auth config from spec
main.jsx—AppProviderwraps everything, loads spec, exposesauthConfig.AuthProviderreceivesauthConfigfromuseAppContext().onUnauthorizedpassed to bothAppProviderandAuthProviderwiresnavigate("/login").401 handling
AppProvider.tsx— removeonUnauthorizedprop (handled byAuthProvider's event listener instead, avoiding double-navigation).useApi.ts— 401 response interceptor dispatchesauth:unauthorizedCustomEvent onwindow.Profile routing fix
Admin.tsx:ProfileRoutes— replace nested<Routes>(which caused/profile/me/meURL duplication with React Router v6) withuseLocation()/useNavigate()conditional rendering. Only allows/profile/meand/profile/me/edit.Admin.tsx:ProfileComponentWrapper— replacepushState() + reload()with React Routernavigate()for bothonEditandhandleSubmit.Debug logging