Skip to content

Commit ebbabec

Browse files
committed
more fixes
1 parent 5516e05 commit ebbabec

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

MyApp.Client/src/pages/posts/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const allYears = [...new Set(allPosts.map((x:any) => new Date(x.date).getFullYea
4444
const allTags = [...new Set(allPosts.flatMap((x:any) => x.tags) as string[])]
4545
const tagCounts: {[tag:string]: number} = {}
4646
allTags.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
4949
function tagLink(tag:string) {
5050
return `/posts/tagged/${generateSlug(tag)}`

MyApp.Client/src/pages/posts/tagged/[tag].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const taggedPosts = computed<Post[]>(() => selectedTag ? allPosts.filter((x:any)
4242
const allTags = [...new Set(allPosts.flatMap((x:any) => x.tags) as string[])]
4343
const tagCounts: {[tag:string]: number} = {}
4444
allTags.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
4747
function tagLink(tag:string) {
4848
return `/posts/tagged/${generateSlug(tag)}`

MyApp.Client/src/routing.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)