Skip to content

Commit 7b5a1e4

Browse files
committed
49
1 parent 434a6ef commit 7b5a1e4

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/pages/ShowPage.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useParams } from "react-router";
22
import axios from 'axios';
33
import { useEffect, useState } from "react";
44
import LoadingSpinner from "../components/LoadingSpinner";
5+
import { Link } from "react-router-dom";
56

67
const ShowPage = () => {
78
const { id } = useParams();
@@ -29,8 +30,18 @@ const ShowPage = () => {
2930

3031
return (
3132
<div>
32-
<h1>{post.title}</h1>
33-
<small class="text-muted">
33+
<div className="d-flex">
34+
<h1 className="flex-grow-1">{post.title}</h1>
35+
<div>
36+
<Link
37+
className="btn btn-primary"
38+
to={`/blogs/${id}/edit`}
39+
>
40+
Edit
41+
</Link>
42+
</div>
43+
</div>
44+
<small className="text-muted">
3445
Created At: {printDate(post.createdAt)}
3546
</small>
3647
<hr />

src/routes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const routes = [
1818
component: CreatePage
1919
},
2020
{
21-
path: '/blogs/edit',
21+
path: '/blogs/:id/edit',
2222
component: EditPage
2323
},
2424
{

0 commit comments

Comments
 (0)