♻️ (store) use a store to store readme and files

This commit is contained in:
2021-03-24 21:23:23 +01:00
parent 165cfb96e7
commit e199c68d68
18 changed files with 202 additions and 229 deletions

View File

@@ -1,21 +1,17 @@
import { useRepo } from '@/hooks/useRepo.hook'
import { computed, Ref } from 'vue'
import { useUserRepoStore } from '@/modules/repo/store/userRepo.store'
import { computed } from 'vue'
export const useFolderNotes = (
folder: string,
owner: Ref<string>,
repo: Ref<string>
) => {
const { tree } = useRepo(owner, repo, true, false)
export const useFolderNotes = (folder: string) => {
const store = useUserRepoStore()
const fleetingNotes = computed(() =>
tree.value.filter(
store.files.filter(
(file) => file.path?.startsWith(folder) && file.path?.endsWith('.md')
)
)
const content = computed(() =>
fleetingNotes.value.length
fleetingNotes.value?.length
? fleetingNotes.value
.map((note) => `- [${note.path}](${note.path})`)
.join('\n')