mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
new selfhosted version
This commit is contained in:
34
dashboard/composables/useAppStart.ts
Normal file
34
dashboard/composables/useAppStart.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
import { toast } from 'vue-sonner';
|
||||
|
||||
async function loadData() {
|
||||
const { loggedIn } = useUserSession();
|
||||
if (!loggedIn.value) return;
|
||||
const router = useRouter();
|
||||
const projectStore = useProjectStore();
|
||||
const snapshotStore = useSnapshotStore();
|
||||
const domainStore = useDomainStore();
|
||||
const premiumStore = usePremiumStore();
|
||||
try {
|
||||
await projectStore.fetchProjects();
|
||||
if (projectStore.projects.length == 0) {
|
||||
router.push('/create_project?first=true');
|
||||
return false;
|
||||
}
|
||||
await projectStore.fetchActivePermissions();
|
||||
await projectStore.fetchPendingInvites();
|
||||
await snapshotStore.fetchSnapshots();
|
||||
await domainStore.fetchDomains();
|
||||
await premiumStore.fetchPremium();
|
||||
return true;
|
||||
} catch (ex: any) {
|
||||
console.error(ex);
|
||||
toast('Error', { description: ex.message, position: 'top-right' });
|
||||
}
|
||||
}
|
||||
|
||||
export function useAppStart() {
|
||||
|
||||
return { loadData }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user