mirror of
https://github.com/Litlyx/litlyx
synced 2026-02-04 06:32:20 +01:00
better first interactions + bug fix
This commit is contained in:
@@ -5,9 +5,9 @@ export function isLiveDemo() {
|
||||
return route.path == '/live_demo';
|
||||
}
|
||||
|
||||
const liveDemoData = useFetch('/api/live_demo');
|
||||
|
||||
export function useLiveDemo() {
|
||||
return useFetch('/api/live_demo', {
|
||||
key: 'live_demo_project'
|
||||
});
|
||||
return liveDemoData;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ function startWatching(instant: boolean = true) {
|
||||
if (instant) getOnlineUsers();
|
||||
watching = setInterval(async () => {
|
||||
await getOnlineUsers();
|
||||
}, 5000);
|
||||
}, 20000);
|
||||
}
|
||||
|
||||
function stopWatching() {
|
||||
|
||||
@@ -68,9 +68,15 @@ async function updateSnapshots() {
|
||||
await remoteSnapshots.refresh();
|
||||
}
|
||||
|
||||
const snapshotDuration = computed(() => {
|
||||
const from = new Date(snapshot.value?.from || 0).getTime();
|
||||
const to = new Date(snapshot.value?.to || 0).getTime();
|
||||
return (to - from) / (1000 * 60 * 60 * 24);
|
||||
});
|
||||
|
||||
export function useSnapshot() {
|
||||
if (remoteSnapshots.status.value === 'idle') {
|
||||
remoteSnapshots.execute();
|
||||
}
|
||||
return { snapshot, snapshots, safeSnapshotDates, updateSnapshots }
|
||||
return { snapshot, snapshots, safeSnapshotDates, updateSnapshots, snapshotDuration }
|
||||
}
|
||||
Reference in New Issue
Block a user