feat: full reload on repo link
This commit is contained in:
@@ -6,22 +6,23 @@ import {
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
toRefs,
|
||||
watch
|
||||
} from 'vue'
|
||||
watch,
|
||||
} from "vue"
|
||||
|
||||
import LiteLoading from '@/components/LiteLoading.vue'
|
||||
import StackedNote from '@/components/StackedNote.vue'
|
||||
import { useLinks } from '@/hooks/useLinks.hook'
|
||||
import { useMarkdown } from '@/hooks/useMarkdown.hook'
|
||||
import { useNoteView } from '@/hooks/useNoteView.hook'
|
||||
import { useRouteQueryStackedNotes } from '@/hooks/useRouteQueryStackedNotes.hook'
|
||||
import { useVisitRepo } from '@/modules/history/hooks/useVisitRepo.hook'
|
||||
import CacheAllNotes from '@/modules/note/components/CacheAllNote.vue'
|
||||
import { useUserRepoStore } from '@/modules/repo/store/userRepo.store'
|
||||
import { useUserSettings } from '@/modules/user/hooks/useUserSettings.hook'
|
||||
import LiteLoading from "@/components/LiteLoading.vue"
|
||||
import StackedNote from "@/components/StackedNote.vue"
|
||||
import { useLinks } from "@/hooks/useLinks.hook"
|
||||
import { useMarkdown } from "@/hooks/useMarkdown.hook"
|
||||
import { useNoteView } from "@/hooks/useNoteView.hook"
|
||||
import { useRouteQueryStackedNotes } from "@/hooks/useRouteQueryStackedNotes.hook"
|
||||
import { useVisitRepo } from "@/modules/history/hooks/useVisitRepo.hook"
|
||||
import CacheAllNotes from "@/modules/note/components/CacheAllNote.vue"
|
||||
import { useUserRepoStore } from "@/modules/repo/store/userRepo.store"
|
||||
import { useUserSettings } from "@/modules/user/hooks/useUserSettings.hook"
|
||||
import { useRoute } from "vue-router"
|
||||
|
||||
const HeaderNote = defineAsyncComponent(
|
||||
() => import('@/components/HeaderNote.vue')
|
||||
() => import("@/components/HeaderNote.vue"),
|
||||
)
|
||||
|
||||
const props = withDefaults(
|
||||
@@ -37,10 +38,11 @@ const props = withDefaults(
|
||||
content: null,
|
||||
parseContent: true,
|
||||
withContent: true,
|
||||
withHeader: true
|
||||
}
|
||||
withHeader: true,
|
||||
},
|
||||
)
|
||||
|
||||
const route = useRoute()
|
||||
const user = computed(() => props.user)
|
||||
const repo = computed(() => props.repo)
|
||||
|
||||
@@ -49,17 +51,17 @@ const store = useUserRepoStore()
|
||||
useUserSettings()
|
||||
const { visitRepo } = useVisitRepo({ user: user, repo: repo })
|
||||
const { toHTML } = useMarkdown(repo)
|
||||
const { listenToClick } = useLinks('note-display')
|
||||
const { listenToClick } = useLinks("note-display")
|
||||
const { stackedNotes, scrollToTop } = useRouteQueryStackedNotes()
|
||||
|
||||
const { titles } = useNoteView('note-container')
|
||||
const { titles } = useNoteView("note-container")
|
||||
|
||||
const renderedContent = computed(() =>
|
||||
props.content !== null
|
||||
? props.parseContent
|
||||
? toHTML(props.content)
|
||||
: props.content
|
||||
: store.readme
|
||||
: store.readme,
|
||||
)
|
||||
|
||||
const hasContent = computed(() => !!renderedContent.value)
|
||||
@@ -71,7 +73,7 @@ watch(
|
||||
await nextTick()
|
||||
listenToClick()
|
||||
},
|
||||
{ immediate: true }
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
watch(
|
||||
@@ -79,7 +81,7 @@ watch(
|
||||
() => {
|
||||
store.setUserRepo(props.user, props.repo)
|
||||
},
|
||||
{ immediate: true }
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
onMounted(() => visitRepo())
|
||||
@@ -101,9 +103,7 @@ const focusREADME = () => scrollToTop()
|
||||
<div class="repo-title">
|
||||
<div class="repo-header">
|
||||
<h1 class="heading-1">
|
||||
<router-link :to="{ name: 'FluxNoteView', params: { user, repo } }">
|
||||
{{ repo }}
|
||||
</router-link>
|
||||
<a :href="route.path">{{ repo }}</a>
|
||||
</h1>
|
||||
{{ user }}
|
||||
</div>
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
import { Notyf } from 'notyf'
|
||||
import { Notyf } from "notyf"
|
||||
|
||||
const notif = new Notyf({
|
||||
types: [
|
||||
{
|
||||
className: 'alert alert-success',
|
||||
type: 'confirm'
|
||||
className: "alert alert-success",
|
||||
type: "confirm",
|
||||
},
|
||||
{
|
||||
className: 'alert alert-error',
|
||||
type: 'error'
|
||||
}
|
||||
]
|
||||
className: "alert alert-error",
|
||||
type: "error",
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
export const confirmMessage = (message: string) =>
|
||||
notif.open({
|
||||
type: 'confirm',
|
||||
message
|
||||
type: "confirm",
|
||||
message,
|
||||
})
|
||||
|
||||
export const errorMessage = (message: string) =>
|
||||
notif.open({
|
||||
type: 'error',
|
||||
message
|
||||
type: "error",
|
||||
message,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user