From bd26b2800e2675613c6990673ad0b7b5175aa841 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Wed, 13 Mar 2024 19:33:33 +0000 Subject: Add zip export --- stores/export.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 stores/export.ts (limited to 'stores/export.ts') diff --git a/stores/export.ts b/stores/export.ts new file mode 100644 index 0000000..3f48aa3 --- /dev/null +++ b/stores/export.ts @@ -0,0 +1,31 @@ +import { defineStore } from 'pinia' + +export type ZipLoaderStatus = 'inactive' | 'preparing' | 'compressing' | 'ready' | 'failed'; + +export const useExportStore = defineStore('export', { + state: () => ({ + zip: { + status: 'inactive' as ZipLoaderStatus, + contents: null as Blob | null, + } + }), + getters: { + getZipStatus: (state) => () => { + return state.zip.status; + }, + getZipContents: (state) => () => { + return state.zip.contents; + }, + }, + actions: { + setZipStatus(status: ZipLoaderStatus) { + this.zip.status = status; + if (status === 'inactive' || status === 'preparing') { + this.zip.contents = null; + } + }, + setZipContents(contents: Blob) { + this.zip.contents = contents; + }, + } +}); -- cgit v1.2.3-70-g09d2