File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed
Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ const allYears = [...new Set(allPosts.map((x:any) => new Date(x.date).getFullYea
4444const allTags = [... new Set (allPosts .flatMap ((x : any ) => x .tags ) as string [])]
4545const tagCounts: {[tag : string ]: number } = {}
4646allTags .forEach (tag => tagCounts [tag ] = allPosts .filter ((x : any ) => x .tags .includes (tag )).length )
47- allTags .sort ((a : string , b : string ) => tagCounts [b ] - tagCounts [a ])
47+ allTags .sort ((a : string , b : string ) => ( tagCounts [b ] ?? 0 ) - ( tagCounts [a ] ?? 0 ) )
4848
4949function tagLink(tag : string ) {
5050 return ` /posts/tagged/${generateSlug (tag )} `
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ const taggedPosts = computed<Post[]>(() => selectedTag ? allPosts.filter((x:any)
4242const allTags = [... new Set (allPosts .flatMap ((x : any ) => x .tags ) as string [])]
4343const tagCounts: {[tag : string ]: number } = {}
4444allTags .forEach (tag => tagCounts [tag ] = allPosts .filter ((x : any ) => x .tags .includes (tag )).length )
45- allTags .sort ((a : string , b : string ) => tagCounts [b ] - tagCounts [a ])
45+ allTags .sort ((a : string , b : string ) => ( tagCounts [b ] ?? 0 ) - ( tagCounts [a ] ?? 0 ) )
4646
4747function tagLink(tag : string ) {
4848 return ` /posts/tagged/${generateSlug (tag )} `
Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ export function configRouter(router:Router) {
2525 // Validate Route guards against Authenticated User's Attributes
2626 const validateRoute = ( to :RouteLocationNormalized , next :NavigationGuardNext , attrs :string [ ] ) => {
2727 for ( let i = 0 ; i < routes . length ; i ++ ) {
28- const { path, attr } = routes [ i ]
28+ const route = routes [ i ]
29+ if ( ! route ) continue
30+ const { path, attr } = route
2931 if ( ! to . path . startsWith ( path ) ) continue
3032 if ( attrs . indexOf ( attr ) === - 1 ) {
3133 const isAdmin = attrs . indexOf ( 'role:Admin' ) >= 0
You can’t perform that action at this time.
0 commit comments