This commit is contained in:
Julien Calixte
2023-08-06 22:23:05 +02:00
parent afc850a0b3
commit fe32ebb99c
2 changed files with 26 additions and 34 deletions

View File

@@ -3,10 +3,12 @@ import { data } from '@/data/data'
import { DataType } from '@/data/DataType.enum'
import { BacklinkNote } from '@/modules/note/models/BacklinkNote'
import { useAsyncState } from '@vueuse/core'
import { onUnmounted } from 'vue'
import { ComputedRef, onUnmounted, toValue } from 'vue'
export const useBacklinks = (sha: string) => {
const backlink = useAsyncState(
export const useBacklinks = (sha: string | ComputedRef<string>) => {
sha = toValue(sha)
const { state: backlink, execute } = useAsyncState(
data.get<DataType.BacklinkNote, BacklinkNote>(
data.generateId(DataType.BacklinkNote, sha)
),
@@ -21,7 +23,7 @@ export const useBacklinks = (sha: string) => {
if (fileSha !== sha) {
return
}
backlink.execute()
execute()
},
{
retro: true