feat: add auth route, update machine status
Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
parent
4578a43197
commit
60424ebe5a
11 changed files with 107 additions and 20 deletions
|
|
@ -1,5 +1,12 @@
|
|||
<script lang="ts">
|
||||
import { page } from '$app/state';
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/state';
|
||||
|
||||
console.log('error on authed page route, ', page);
|
||||
|
||||
setTimeout(() => {
|
||||
goto('/entry');
|
||||
}, 3000);
|
||||
</script>
|
||||
|
||||
<h1>{page.status} {page.error?.message}</h1>
|
||||
<h1>{page.status} {page.error?.message}</h1>
|
||||
|
|
|
|||
|
|
@ -65,10 +65,21 @@
|
|||
let currentUser = get(auth);
|
||||
// console.log(`on mount layout current user: ${JSON.stringify(currentUser)}`);
|
||||
if (currentUser) {
|
||||
connectToWebsocket();
|
||||
// console.log('id', await currentUser.getIdToken());
|
||||
|
||||
console.log('connect ws on mount');
|
||||
connectToWebsocket(await currentUser.getIdToken());
|
||||
await tryAutoConnect();
|
||||
}
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
console.log('connect ws on effect');
|
||||
|
||||
setTimeout(async () => {
|
||||
connectToWebsocket(await get(auth)?.getIdToken());
|
||||
}, 100);
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@
|
|||
|
||||
// setTimeout(() => recipeLoading.set(false), 3000);
|
||||
}
|
||||
}, 30000);
|
||||
}, 10000);
|
||||
|
||||
version_list = get(currentRecipeVersionsSelector);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
sendCommandRequest('sheet', {
|
||||
country: refDepartment,
|
||||
param: 'get_all_catalogs'
|
||||
param: 'catalogs'
|
||||
});
|
||||
|
||||
// await getRecipes();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,25 @@
|
|||
<script lang="ts">
|
||||
import { page } from '$app/state';
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
// Svelte 5 approach
|
||||
$effect(() => {
|
||||
// Redirect to home after a very brief delay or immediately
|
||||
goto('/');
|
||||
});
|
||||
|
||||
// Fallback for SEO or slow JS: a meta refresh tag
|
||||
</script>
|
||||
|
||||
<h1>{page.status} {page.error?.message}</h1>
|
||||
<svelte:head>
|
||||
<!-- Redirects after 2 seconds if JavaScript fails to load -->
|
||||
<meta http-equiv="refresh" content="2;url=/" />
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex h-screen flex-col items-center justify-center gap-2">
|
||||
<h1 class="font-sans text-5xl text-foreground">Redirecting...</h1>
|
||||
<p class="my-8 text-xl text-muted-foreground">
|
||||
Something went wrong. Sending you back to the home page.
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue