Authentication UI and state for Khata front-ends: a JWT-backed
AuthProvider context, a pluggable login/register AuthPage, profile
screens, and an axios factory that attaches bearer tokens and reacts to
401 responses.
What this library gives you
AuthProvider + useAuth - manages the current user, token, and
loading/error state; persists the token in localStorage and re-fetches
the current user whenever the token changes.
createApiClient - creates an axios instance whose request
interceptor adds Authorization: Bearer <token>, and whose response
interceptor clears the token and dispatches a auth:unauthorized window
event on 401.
AuthPage - a ready-made login/register screen driven by the
useAuth callbacks.
ProfileCreate / ProfileEdit / ProfileView - presentational
profile screens that delegate persistence to callbacks you supply.
tokenStore - the raw localStorage accessor (get/set/clear).
react-auth
Authentication UI and state for Khata front-ends: a JWT-backed
AuthProvidercontext, a pluggable login/registerAuthPage, profile screens, and an axios factory that attaches bearer tokens and reacts to401responses.What this library gives you
AuthProvider+useAuth- manages the current user, token, and loading/error state; persists the token inlocalStorageand re-fetches the current user whenever the token changes.createApiClient- creates an axios instance whose request interceptor addsAuthorization: Bearer <token>, and whose response interceptor clears the token and dispatches aauth:unauthorizedwindow event on401.AuthPage- a ready-made login/register screen driven by theuseAuthcallbacks.ProfileCreate/ProfileEdit/ProfileView- presentational profile screens that delegate persistence to callbacks you supply.tokenStore- the rawlocalStorageaccessor (get/set/clear).Wiring