Files
voidraft/frontend/src/stores/syncStore.ts
2026-03-30 00:03:23 +08:00

26 lines
491 B
TypeScript

import { defineStore } from 'pinia';
import { ref } from 'vue';
import { SyncService } from '@/../bindings/voidraft/internal/services';
export const useSyncStore = defineStore('sync', () => {
const isSyncing = ref(false);
const sync = async (): Promise<void> => {
if (isSyncing.value) {
return;
}
isSyncing.value = true;
try {
await SyncService.Sync();
} finally {
isSyncing.value = false;
}
};
return {
isSyncing,
sync
};
});