diff options
Diffstat (limited to 'stores/export.ts')
| -rw-r--r-- | stores/export.ts | 31 |
1 files changed, 31 insertions, 0 deletions
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; + }, + } +}); |
