diff --git a/FrontEnd/src/api/blog.js b/FrontEnd/src/api/blog.js index d5fbbeb..0a02407 100644 --- a/FrontEnd/src/api/blog.js +++ b/FrontEnd/src/api/blog.js @@ -195,4 +195,15 @@ export const getLatestBlogPosts = async () => { console.log(error); return []; } +}; + +// get authors all blogs +export const getAuthorAllBlogs = async (authorId) => { + try { + const response = await axios.get(`/api/blog/author/${authorId}`); + return response.data; + } catch (error) { + console.log(error); + return []; + } }; \ No newline at end of file diff --git a/FrontEnd/src/components/blog/PublicBlogCard.jsx b/FrontEnd/src/components/blog/PublicBlogCard.jsx index d770d51..049f4f6 100644 --- a/FrontEnd/src/components/blog/PublicBlogCard.jsx +++ b/FrontEnd/src/components/blog/PublicBlogCard.jsx @@ -21,20 +21,20 @@ const PublicBlogCrad = ({ handleBookmark, logged, }) => { - // const [isBookmarked, setIsBookmarked] = useState(false); - // const [isLogged, setIsLogged] = useState(false); + const [isBookmarked, setIsBookmarked] = useState(false); + const [isLogged, setIsLogged] = useState(false); - // useEffect(() => { - // if (user && user == bookmarked) { - // setIsBookmarked(true); - // } - // }, [bookmarked, user]); + useEffect(() => { + if (user && user == bookmarked) { + setIsBookmarked(true); + } + }, [bookmarked, user]); - // useEffect(() => { - // if (logged) { - // setIsLogged(true); - // } - // }); + useEffect(() => { + if (logged) { + setIsLogged(true); + } + }); //date formatter function formatDate(dateString) { @@ -59,7 +59,7 @@ const PublicBlogCrad = ({