Skip to content

Commit 95c25ed

Browse files
committed
displaying username better
1 parent 60f6180 commit 95c25ed

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

blog-frontend/src/App.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import SignUp from './components/SignUp';
1010
import { axiosInstance } from './services/authServices';
1111
import PostForm from './components/PostForm';
1212
import PostDetails from './pages/PostDetails';
13+
import EditPost from './pages/EditPost';
1314
// import {getUserFromToken } from './services/userService'
1415

1516
const App : React.FC = () => {
@@ -55,7 +56,7 @@ const App : React.FC = () => {
5556
<PostCard
5657
key={post.id}
5758
title={post.title}
58-
author={post.author}
59+
author={post.username}
5960
excerpt={post.excerpt}
6061
status={post.status}
6162
published={post.published}
@@ -77,6 +78,7 @@ const App : React.FC = () => {
7778
<Route exact path="/posts/:title">
7879
<PostDetails />
7980
</Route>
81+
8082
</Router>
8183
</>
8284
);

blog-frontend/src/components/PostForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const PostForm : FC<Props> = ({user}) => {
2424
title,
2525
content,
2626
status,
27-
author:user,
27+
username:user,
2828
excerpt: content.split(' ').slice(0,3).join(' '),
2929
published,
3030
slug: slugiy(title),

blog-frontend/src/pages/PostDetails.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const PostDetails = () => {
2121
return (
2222
<>
2323
<h1>{post?.title}</h1>
24-
<small>By {post?.author}</small>
24+
<small>By {post?.username}</small>
2525
<p>{post?.content}</p>
2626
<small>Publication Date: {moment(post?.published).format('MMMM Do YYYY, h:mm:ss a')}</small>
2727
{post?.category&& <small>Categories: {post?.category.map(cat=>cat+",")}</small> }

blog-frontend/src/services/blogServices.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const BASE_URL = 'http://127.0.0.1:8000/api/posts/'
55
export interface Post {
66
id?: number;
77
title: string;
8-
author: string;
8+
username: string;
99
excerpt: string;
1010
content: string;
1111
status:string;

0 commit comments

Comments
 (0)