fix: set and use correct type for destructured props
This commit is contained in:
@ -1,19 +1,19 @@
|
||||
import {ref, watch, type Ref} from 'vue'
|
||||
import {ref, watch, type ShallowReactive} from 'vue'
|
||||
import ProjectService from '@/services/project'
|
||||
import type {IProject} from '@/modelTypes/IProject'
|
||||
import {getBlobFromBlurHash} from '@/helpers/getBlobFromBlurHash'
|
||||
|
||||
export function useProjectBackground(project: Ref<IProject>) {
|
||||
export function useProjectBackground(project: ShallowReactive<IProject>) {
|
||||
const background = ref<string | null>(null)
|
||||
const backgroundLoading = ref(false)
|
||||
const blurHashUrl = ref('')
|
||||
|
||||
watch(
|
||||
() => [project.value.id, project.value.backgroundBlurHash] as [IProject['id'], IProject['backgroundBlurHash']],
|
||||
() => [project.id, project.backgroundBlurHash] as [IProject['id'], IProject['backgroundBlurHash']],
|
||||
async ([projectId, blurHash], oldValue) => {
|
||||
if (
|
||||
project.value === null ||
|
||||
!project.value.backgroundInformation ||
|
||||
project === null ||
|
||||
!project.backgroundInformation ||
|
||||
backgroundLoading.value
|
||||
) {
|
||||
return
|
||||
@ -36,7 +36,7 @@ export function useProjectBackground(project: Ref<IProject>) {
|
||||
})
|
||||
|
||||
const projectService = new ProjectService()
|
||||
const backgroundPromise = projectService.background(project.value).then((result) => {
|
||||
const backgroundPromise = projectService.background(project).then((result) => {
|
||||
background.value = result
|
||||
})
|
||||
await Promise.all([blurHashPromise, backgroundPromise])
|
||||
|
Reference in New Issue
Block a user