(history) add history list of last visited repos

This commit is contained in:
Julien Calixte
2021-12-12 00:10:38 +01:00
parent 070acfd3ca
commit a22218b8b2
5 changed files with 72 additions and 2 deletions

View File

@@ -0,0 +1,20 @@
import { data } from '@/data/data'
import { DataType } from '@/data/DataType.enum'
import { History } from '@/data/models/History'
import { useAsyncState } from '@vueuse/core'
import { computed } from 'vue'
export const useLastVisitedRepos = () => {
const history = useAsyncState(
data.get<DataType.History, History>(
data.generateId(DataType.BacklinkNote, 'history')
),
null
)
const lastVisitedRepos = computed(() => history.state.value?.repos ?? [])
return {
lastVisitedRepos
}
}