feat: hasAttachments as store computed
This commit is contained in:
parent
1563c462a2
commit
1f55e3f866
|
|
@ -1,4 +1,4 @@
|
|||
import {ref, readonly} from 'vue'
|
||||
import {ref, computed, readonly} from 'vue'
|
||||
import {defineStore, acceptHMRUpdate} from 'pinia'
|
||||
import {findIndexById} from '@/helpers/utils'
|
||||
|
||||
|
|
@ -23,11 +23,14 @@ export const useAttachmentStore = defineStore('attachment', () => {
|
|||
console.debug('Remove attachement', id)
|
||||
}
|
||||
|
||||
const hasAttachments = computed(() => attachments.value.length > 0)
|
||||
|
||||
return {
|
||||
attachments: readonly(attachments),
|
||||
set,
|
||||
add,
|
||||
removeById,
|
||||
hasAttachments,
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -587,6 +587,7 @@
|
|||
<script lang="ts" setup>
|
||||
import {ref, reactive, shallowReactive, computed, watch, nextTick, onMounted, onBeforeUnmount} from 'vue'
|
||||
import {useRouter, type RouteLocation} from 'vue-router'
|
||||
import {storeToRefs} from 'pinia'
|
||||
import {useI18n} from 'vue-i18n'
|
||||
import {unrefElement} from '@vueuse/core'
|
||||
import {klona} from 'klona/lite'
|
||||
|
|
@ -657,6 +658,7 @@ const {t} = useI18n({useScope: 'global'})
|
|||
|
||||
const projectStore = useProjectStore()
|
||||
const attachmentStore = useAttachmentStore()
|
||||
const {hasAttachments} = storeToRefs(attachmentStore)
|
||||
const taskStore = useTaskStore()
|
||||
const kanbanStore = useKanbanStore()
|
||||
const authStore = useAuthStore()
|
||||
|
|
@ -710,8 +712,6 @@ const color = computed(() => {
|
|||
return color
|
||||
})
|
||||
|
||||
const hasAttachments = computed(() => attachmentStore.attachments.length > 0)
|
||||
|
||||
const isModal = computed(() => Boolean(props.backdropView))
|
||||
|
||||
function attachmentUpload(file: File, onSuccess?: (url: string) => void) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue