Update SingleBlog.tsx

This commit is contained in:
Nicholas Orlowsky 2023-03-21 12:03:11 -05:00 committed by GitHub
parent e375cbe23d
commit 9c63f53f6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,7 +13,8 @@ function SingleBlog() {
const [blogText, setBlogText] = useState<string>('');
useEffect(()=> {
let blogName = window.location.pathname.split('/').at(-1);
let pathParts = window.location.pathname.split('/');
let blogName = pathParts[pathParts.length - 1];
setBlog(AllBlogs.find(b => b.uri == blogName));
}, [])