mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-10 03:37:44 +02:00
[eric] free-trial: refetch settings after mint unconditionally (arms even if the response is unreadable)
This commit is contained in:
@@ -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]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user