✨ (history) add history list of last visited repos
This commit is contained in:
20
src/modules/history/hooks/useLastVisitedRepos.hook.ts
Normal file
20
src/modules/history/hooks/useLastVisitedRepos.hook.ts
Normal 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user