mirror of
https://github.com/ershisan99/coolify.git
synced 2026-01-24 05:02:12 +00:00
v1.0.12 - Sveltekit migration (#44)
Changed the whole tech stack to SvelteKit which means: - Typescript - SSR - No fastify :( - Beta, but it's fine! Other changes: - Tailwind -> Tailwind JIT - A lot more
This commit is contained in:
44
src/routes/dashboard/__layout.svelte
Normal file
44
src/routes/dashboard/__layout.svelte
Normal file
@@ -0,0 +1,44 @@
|
||||
<script context="module" lang="ts">
|
||||
import { request } from '$lib/api/request';
|
||||
/**
|
||||
* @type {import('@sveltejs/kit').Load}
|
||||
*/
|
||||
export async function load(session) {
|
||||
return {
|
||||
props: {
|
||||
initDashboard: await request('/api/v1/dashboard', session)
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export let initDashboard;
|
||||
import { dashboard } from '$store';
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import { session } from '$app/stores';
|
||||
$dashboard = initDashboard;
|
||||
let loadDashboardInterval = null;
|
||||
|
||||
async function loadDashboard() {
|
||||
try {
|
||||
$dashboard = await request('/api/v1/dashboard', $session);
|
||||
} catch (error) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
await loadDashboard();
|
||||
loadDashboardInterval = setInterval(async () => {
|
||||
await loadDashboard();
|
||||
}, 2000);
|
||||
});
|
||||
onDestroy(() => {
|
||||
clearInterval(loadDashboardInterval);
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="min-h-full">
|
||||
<slot />
|
||||
</div>
|
||||
Reference in New Issue
Block a user