fix(frontend): handle /editor gracefully and enable desktopLayout for teacher arduino tab
This commit is contained in:
parent
c3fc8dc8f1
commit
21ffb65e05
|
|
@ -20,6 +20,13 @@ function resolveBackend(): string {
|
|||
const API_BACKEND = resolveBackend();
|
||||
|
||||
export const handle: Handle = async ({ event, resolve }) => {
|
||||
console.log(`[hooks] ${event.request.method} ${event.url.pathname} (referer: ${event.request.headers.get('referer')})`);
|
||||
|
||||
// Redirect /editor or /editor/ to /velxio/editor
|
||||
if (event.url.pathname === '/editor' || event.url.pathname === '/editor/' || event.url.pathname.startsWith('/editor/')) {
|
||||
return Response.redirect(`${event.url.origin}/velxio/editor${event.url.search}`, 302);
|
||||
}
|
||||
|
||||
// Proxy /api/* and /assets/* to Flask backend
|
||||
const isApi = event.url.pathname.startsWith('/api/');
|
||||
const isAsset = event.url.pathname.startsWith('/assets/');
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
let saveFeedback = $state<string | null>(null);
|
||||
let feedbackTimeout: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
const velxioSrc = '/velxio/editor?embed=true';
|
||||
const velxioSrc = '/velxio/editor?embed=true&desktopLayout=true';
|
||||
|
||||
export function getCurrentState(): { code: string; circuit: string } | null {
|
||||
return getVelxioState(iframeRef);
|
||||
|
|
|
|||
Loading…
Reference in New Issue