aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src/store/uploader.ts
blob: 12c0f77cbf214d9f4e4826222a3c804f578e2d06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
 * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
import type { Uploader } from '@nextcloud/upload'
import type { UploaderStore } from '../types'

import { defineStore } from 'pinia'
import { getUploader } from '@nextcloud/upload'

let uploader: Uploader

export const useUploaderStore = function(...args) {
	// Only init on runtime
	uploader = getUploader()

	const store = defineStore('uploader', {
		state: () => ({
			queue: uploader.queue,
		} as UploaderStore),
	})

	return store(...args)
}