[eric] free-trial: refetch settings after mint unconditionally (arms even if the response is unreadable)

This commit is contained in:
ciregenz
2026-06-13 17:08:27 -07:00
parent cee7a94559
commit 9f1c738ab2
+4 -3
View File
@@ -231,10 +231,11 @@ const SettingsLoader: React.FC<{ children: React.ReactNode }> = ({ children }) =
// user can run an agent immediately. The backend no-ops if a real key or
// subscription exists, so this is safe to fire on every launch.
fetch(`${API_BASE}/subscription/free-trial/mint`, { method: 'POST' })
.then((r) => (r.ok ? r.json() : null))
.then((data) => { if (data && data.armed) dispatch(fetchSettings()); })
.catch(() => {})
.finally(() => { dispatch(markFreeTrialArmSettled()); });
// The backend arms server-side regardless of whether the browser can read the mint
// response (a transient boot-time CORS/timing miss makes `data` unreadable), so refetch
// unconditionally, the GET is the only reliable signal the UI gets that it armed.
.finally(() => { dispatch(fetchSettings()); dispatch(markFreeTrialArmSettled()); });
});
}, [dispatch]);