fixed router in Post
This commit is contained in:
parent
792874b3fc
commit
94742e01f4
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue