Fix basePath?

pull/15/head
Max Leiter 3 years ago
parent 144574535a
commit 9a0b83c992
No known key found for this signature in database
GPG Key ID: A3512F2F2F17EBDA

@ -3,8 +3,9 @@ import { useRouter } from "next/router";
const Link = (props: LinkProps) => {
const { basePath } = useRouter();
const href = basePath ? `/${basePath}/${props.href}` : props.href;
const propHrefWithoutLeadingSlash = props.href ? props.href.replace(/^\//, "") : props.href;
const href = basePath ? `/${basePath}/${propHrefWithoutLeadingSlash}` : props.href;
return <GeistLink {...props} href={href} />
}
export default Link
export default Link

Loading…
Cancel
Save