From bf185e9858203751f7c3d13ba00a75baa21a225c Mon Sep 17 00:00:00 2001 From: Admin Date: Wed, 23 Sep 2026 02:45:37 +0000 Subject: [PATCH] feat: add src/main.tsx --- src/main.tsx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/main.tsx diff --git a/src/main.tsx b/src/main.tsx new file mode 100644 index 0000000..55a81f2 --- /dev/null +++ b/src/main.tsx @@ -0,0 +1,33 @@ +import React from 'react' +import ReactDOM from 'react-dom/client' +import { registerSW } from 'virtual:pwa-register' +import { App } from './App' +import './styles.css' + +async function bootstrap() { + registerSW({ immediate: true }) + + const session = await fetch('/api/session', { headers: { Accept: 'application/json' } }) + if (session.status === 401) { + window.location.assign('/auth/login') + return + } + if (!session.ok) throw new Error(`Session check failed: ${session.status}`) + + const payload = await session.json() + ReactDOM.createRoot(document.getElementById('root')!).render( + + + + ) +} + +bootstrap().catch(error => { + document.body.innerHTML = ` +
+

Template Studio

+

Unable to start the application.

+
${String(error)}
+
+ ` +})