Fix/session refresh and powergrid simu proxy - #25
Merged
Conversation
Two demo-stability fixes that were developed together. Session handling ---------------- The eval-demo hack that disabled auto-logout entirely is removed. In its place the access token is now actually renewed: - new utils/session.ts: decodes the JWT `exp` claim, and funnels every "session is over" path through a single handleSessionExpired() guarded so a burst of 401s yields one modal and one redirect, not one popup per failed request. - auth store gains refresh()/scheduleRefresh(), a shared in-flight refresh promise, and isTokenExpired/canRefresh. A timer renews the token a minute before it dies. - http interceptor retries a 401 once after refreshing, and only ends the session when the refresh token is gone too. - the router guard renews on navigation, so a reloaded tab restoring a persisted token does not die at the next poll. - the card subscription bypasses axios, so it does the same dance itself. - services store now owns the context-polling interval id, fixing a leak where an interval restarted from the retry modal was never cancellable. PowerGrid "apply action" proxy ------------------------------ The apply POST goes to a same-origin /powergrid-simu/ nginx location to avoid CORS; several environments were missing their half of that wiring: - CI never passed the VITE_POWERGRID_SIMU build-arg, so published images baked an empty base, posted to / and got nginx 405. - the k8s configmap had no /powergrid-simu/ location at all. - the compose and image nginx configs sent an explicit Host header, which routes to the wrong vhost behind the passerelle; dropping it lets nginx default to $proxy_host, correct for ip:port and vhost upstreams alike. - .env.example documents the per-environment upstream and no longer ships a real RL_AGENT_API_TOKEN value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.