Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

dashboard-next/monetize: handle ApiError 401 during page boot

nirholas8e68f16adc91
diff --git a/src/dashboard-next/pages/monetize.js b/src/dashboard-next/pages/monetize.js
index 31f9efbed..b2050a40a 100644
--- a/src/dashboard-next/pages/monetize.js
+++ b/src/dashboard-next/pages/monetize.js
@@ -32,17 +32,27 @@ const PAYMENT_FILTERS = [
];
(async function boot() {
- const main = await mountShell();
- const me = await requireUser();
+ try {
+ const main = await mountShell();
+ const me = await requireUser();
- main.innerHTML = `
- <h1 class="dn-h1">Money</h1>
- <p class="dn-h1-sub">Where your agents earn — and where it goes.</p>
- <div data-slot="content" style="display:flex;flex-direction:column;gap:18px"></div>
- `;
- const host = main.querySelector('[data-slot="content"]');
- renderSkeleton(host);
- await loadAndRender(host, me);
+ main.innerHTML = `
+ <h1 class="dn-h1">Money</h1>
+ <p class="dn-h1-sub">Where your agents earn — and where it goes.</p>
+ <div data-slot="content" style="display:flex;flex-direction:column;gap:18px"></div>
+ `;
+ const host = main.querySelector('[data-slot="content"]');
+ renderSkeleton(host);
+ await loadAndRender(host, me);
+ } catch (err) {
+ // Session expired mid-load — bounce to login the same way requireUser would.
+ if (err instanceof ApiError && err.status === 401) {
+ const ret = encodeURIComponent(location.pathname + location.search);
+ location.href = `/login?return=${ret}`;
+ return;
+ }
+ throw err;
+ }
})();
// ── Data loading ───────────────────────────────────────────────────────────