refactor: improvemets
Build Test / test (pull_request) Successful in 1m58s
JS Unit Tests / test (pull_request) Successful in 1m58s
PHP Unit Tests / test (pull_request) Successful in 2m29s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-03-24 19:12:02 -04:00
parent 4bcfbf6d0e
commit 78449a702b
2 changed files with 140 additions and 21 deletions
+17 -2
View File
@@ -5,10 +5,11 @@
*/
import { ref, onMounted, onUnmounted } from 'vue';
import type { Ref } from 'vue';
import { useEntitiesStore } from '../stores/entitiesStore';
import { useCollectionsStore } from '../stores/collectionsStore';
interface SyncSource {
export interface SyncSource {
provider: string;
service: string | number;
collections: (string | number)[];
@@ -23,7 +24,21 @@ interface SyncOptions {
fetchDetails?: boolean;
}
export function useMailSync(options: SyncOptions = {}) {
export interface MailSyncController {
isRunning: Ref<boolean>;
lastSync: Ref<Date | null>;
error: Ref<string | null>;
sources: Ref<SyncSource[]>;
addSource: (source: SyncSource) => void;
removeSource: (source: SyncSource) => void;
clearSources: () => void;
sync: () => Promise<void>;
start: () => void;
stop: () => void;
restart: () => void;
}
export function useMailSync(options: SyncOptions = {}): MailSyncController {
const {
interval = 30000,
autoStart = true,