diff --git a/app/dashboard/published/page.js b/app/dashboard/published/page.js index eab9f830..00862c22 100644 --- a/app/dashboard/published/page.js +++ b/app/dashboard/published/page.js @@ -51,6 +51,7 @@ export default async function AccountPage() { currentTab="publish" postStatus={["publish"]} postType="" + edit={false} /> {/* */} diff --git a/components/Dashboard/PostCard.jsx b/components/Dashboard/PostCard.jsx index caf4f90c..58a17e18 100644 --- a/components/Dashboard/PostCard.jsx +++ b/components/Dashboard/PostCard.jsx @@ -75,6 +75,8 @@ const PostCard = ({ post, refetch, user, edit }) => { href={ edit === false && post.type == "article" ? `/post/${post.slug}` + : edit === false && post.type == "note" + ? `/note/${post.slug}` : edit === false && post.type == "tool" ? `/toolbox/${post.slug}` : post.type == "article" && post.tools?.length diff --git a/pages/api/revalidate.js b/pages/api/revalidate.js index 94b8fcb5..f44ef593 100644 --- a/pages/api/revalidate.js +++ b/pages/api/revalidate.js @@ -26,6 +26,19 @@ export default async function handler(req, res) { } return res.json({ revalidated: true }); } + else if ( + entry.type == "note" && + (entry.status === "publish" || entry.publishedAt) + ) { + const url = `/note/${entry.slug}`; + + await res.revalidate(url); + if (process.env.NODE_ENV == "production") { + await purgeCloudFlareCache(url); + await clearAuthCache(entry.id); + } + return res.json({ revalidated: true }); + } //revalidate jobs else if (entry.type == "job" && entry.publishedAt) { console.log("revalidating job post :", entry.slug); diff --git a/pages/note/[slug].js b/pages/note/[slug].js index 109d4d55..90a249dc 100644 --- a/pages/note/[slug].js +++ b/pages/note/[slug].js @@ -136,10 +136,11 @@ export default function Post({ const ogImage = `${ process.env.NEXT_PUBLIC_HOME_URL - }/api/og-generator/og-note?title=${encodeURIComponent(title)}&author=${encodeURIComponent( - authorName - )}&date=${encodeURIComponent(date)}&avatar=${encodeURIComponent(avatar)}`; - + }/api/og-generator/og-note?title=${encodeURIComponent( + title + )}&author=${encodeURIComponent(authorName)}&date=${encodeURIComponent( + date + )}&avatar=${encodeURIComponent(avatar)}`; return (
- {user?.isAdmin && ( -
- {/* */} -
- )} - {!user?.isAdmin && user?.id == post?.attributes?.author?.data?.id ? ( -
- {/* */} -
- ) : null} - {/* */}
{/* {post?.id && process.env.NODE_ENV === "production" && ( @@ -206,8 +182,8 @@ export default function Post({
- -
Note
+ +
Note

{title} @@ -268,13 +244,44 @@ export default function Post({

) : null} -
+
+
+ {user?.isAdmin && ( +
+ {/* */} +
+ )} + {!user?.isAdmin && + user?.id == post?.attributes?.author?.data?.id ? ( +
+ {/* */} +
+ ) : null} +