File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { useParams } from "react-router";
2
2
import axios from 'axios' ;
3
3
import { useEffect , useState } from "react" ;
4
4
import LoadingSpinner from "../components/LoadingSpinner" ;
5
+ import { Link } from "react-router-dom" ;
5
6
6
7
const ShowPage = ( ) => {
7
8
const { id } = useParams ( ) ;
@@ -29,8 +30,18 @@ const ShowPage = () => {
29
30
30
31
return (
31
32
< 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" >
34
45
Created At: { printDate ( post . createdAt ) }
35
46
</ small >
36
47
< hr />
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ const routes = [
18
18
component : CreatePage
19
19
} ,
20
20
{
21
- path : '/blogs/edit' ,
21
+ path : '/blogs/:id/ edit' ,
22
22
component : EditPage
23
23
} ,
24
24
{
You can’t perform that action at this time.
0 commit comments