refactor: improvemets
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user