refacto
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user