♻️ (notes) home is now the note initial screen with a fo…
This commit is contained in:
@@ -13,12 +13,9 @@ const sanitizePath = (path: string) => {
|
||||
return decodeURIComponent(path)
|
||||
}
|
||||
|
||||
export const useNote = (user: string, repo: string) => {
|
||||
export const useNote = (user?: string, repo?: string) => {
|
||||
const { push } = useRouter()
|
||||
const { readme, notFound, tree } = useRepo(user, repo)
|
||||
const { listenToClick } = useLinks('note-display')
|
||||
const { query } = useRoute()
|
||||
|
||||
const stackedNotes = ref(
|
||||
query.stackedNotes
|
||||
? Array.isArray(query.stackedNotes)
|
||||
@@ -27,6 +24,17 @@ export const useNote = (user: string, repo: string) => {
|
||||
: []
|
||||
)
|
||||
|
||||
if (!user || !repo) {
|
||||
return {
|
||||
readme: ref(null),
|
||||
notFound: ref(true),
|
||||
stackedNotes
|
||||
}
|
||||
}
|
||||
|
||||
const { readme, notFound, tree } = useRepo(user, repo)
|
||||
const { listenToClick } = useLinks('note-display')
|
||||
|
||||
const unsubscribe = noteEventBus.addEventBusListener(
|
||||
({ path, currentNoteSHA }) => {
|
||||
const currentFile = tree.value.find((file) => file.sha === currentNoteSHA)
|
||||
@@ -68,7 +76,11 @@ export const useNote = (user: string, repo: string) => {
|
||||
const newStackedNotes = getStackedNotes()
|
||||
|
||||
push({
|
||||
name: 'Note',
|
||||
name: 'Home',
|
||||
params: {
|
||||
user,
|
||||
repo
|
||||
},
|
||||
query: {
|
||||
stackedNotes: newStackedNotes
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user