9fcfe32ea7
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
37 lines
764 B
TypeScript
37 lines
764 B
TypeScript
import { defineStore } from 'pinia'
|
|
import { ref } from 'vue'
|
|
|
|
export interface PreviewAvailability {
|
|
enabled: boolean
|
|
storage: boolean
|
|
generation: boolean
|
|
}
|
|
|
|
const unavailable = (): PreviewAvailability => ({
|
|
enabled: false,
|
|
storage: false,
|
|
generation: false,
|
|
})
|
|
|
|
export const usePreviewStore = defineStore('previewStore', () => {
|
|
const availability = ref<PreviewAvailability>(unavailable())
|
|
|
|
function init(data?: Partial<PreviewAvailability> | null): void {
|
|
availability.value = {
|
|
enabled: data?.enabled ?? false,
|
|
storage: data?.storage ?? false,
|
|
generation: data?.generation ?? false,
|
|
}
|
|
}
|
|
|
|
function reset(): void {
|
|
availability.value = unavailable()
|
|
}
|
|
|
|
return {
|
|
availability,
|
|
init,
|
|
reset,
|
|
}
|
|
})
|