fixed router in Post

This commit is contained in:
Orion Reed 2023-08-12 19:06:37 +01:00
parent 792874b3fc
commit 94742e01f4
2 changed files with 5 additions and 3 deletions

View File

@ -26,7 +26,7 @@ export function Header({ dark }: { dark?: boolean }) {
<Container size="40em">
<Group align="end">
<Anchor href="/" className={classes.home}>
orion reed 0
orion reed 1
</Anchor>
<Anchor href="/posts" className={classes.link}>
posts

View File

@ -10,7 +10,7 @@ import Markdown from 'markdown-to-jsx'
import matter from 'gray-matter'
import { readingTime } from 'reading-time-estimator'
import { Header } from '@/components/Header'
import { useRoute } from 'preact-iso'
import { getCurrentUrl } from 'preact-router'
import { useState, useEffect } from 'preact/hooks'
import { friendlyDate } from '@/utils'
@ -38,7 +38,9 @@ async function getPost(name: string) {
}
export default function Post() {
const current = useRoute().params.title
const current = getCurrentUrl().split('/')[2]
console.log(current)
const [post, setPost] = useState(null)
const { classes } = useStyles()