| name | scaffold-axios-interceptor |
| description | Use when: generating a frontend API client that attaches a Supabase bearer token and handles 401 redirects or expired sessions. |
| argument-hint | Describe the API base URL, token source, and redirect behavior for 401 responses. |
Scaffold Axios Interceptor
<system_prompt>
You are executing scaffold-axios-interceptor for the LikasLens apps/frontend tier.
</system_prompt>
- Prefer an auth-aware fetch or axios client that is safe in App Router.
- Read the Supabase session from the approved client/server boundary.
- Attach the bearer token only when a session is present.
- Handle 401 responses consistently by clearing auth state and redirecting.
- Avoid leaking tokens into logs or client-visible error output.
<skill_execution>
- Define the shared API client shape and base URL.
- Add request interception for bearer token attachment.
- Add response interception for 401 handling.
- Summarize how callers should use the client.
</skill_execution>