- {Cookies.get("username")}
+ {Cookies.get("username")}
{Cookies.get("email")}
@@ -111,7 +116,7 @@ const Dropdown = () => {
onClick={handleMenuItemClick}
className="block px-4 py-3 text-sm text-gray-600 capitalize transition-colors duration-200 transform dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 dark:hover:text-white"
>
- Subscribe
+ Subscribe
)}
diff --git a/src/components/Navbar/Location.jsx b/src/components/Navbar/Location.jsx
index 157b07f..a45f805 100644
--- a/src/components/Navbar/Location.jsx
+++ b/src/components/Navbar/Location.jsx
@@ -16,6 +16,7 @@ export const useRouteVariables = () => {
hideHomeLink: location.pathname.startsWith("/posts/"),
isEmailPage: location.pathname==="/email",
isConfirmPage: location.pathname==="/confirm-unsubscribe",
- isForgotPage: location.pathname ==="/forgot-password"
+ isForgotPage: location.pathname ==="/forgot-password",
+ isResetPasswordPage: location.pathname.startsWith("/reset-password/"),
};
};
diff --git a/src/components/Navbar/Navbar.jsx b/src/components/Navbar/Navbar.jsx
index c4e5c1a..c3206ec 100644
--- a/src/components/Navbar/Navbar.jsx
+++ b/src/components/Navbar/Navbar.jsx
@@ -23,6 +23,7 @@ const Navbar = () => {
isEmailPage,
isConfirmPage,
isForgotPage,
+ isResetPasswordPage
} = useRouteVariables();
const [open, setOpen] = useState(false);
@@ -30,7 +31,7 @@ const Navbar = () => {
const toggleMenu = () => {
setOpen(!open);
};
- if (isLoginPage || isSignupPage || isEmailPage || isForgotPage) {
+ if (isLoginPage || isSignupPage || isEmailPage || isForgotPage || isResetPasswordPage) {
return null;
}
diff --git a/src/components/PostDetailsCard.jsx b/src/components/PostDetailsCard.jsx
index 7e764e4..a08dd4f 100644
--- a/src/components/PostDetailsCard.jsx
+++ b/src/components/PostDetailsCard.jsx
@@ -14,10 +14,12 @@ import { faArrowLeft } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
export function PostDetailsCard() {
const { state } = useLocation();
- const relativeDate = moment(state.post.createdAt).fromNow();
+ const relativeDate = state?.post
+ ? moment(state.post.createdAt).fromNow()
+ : "";
const [commentText, setCommentText] = useState("");
const { getPost } = usePosts();
- const [postData, setPostData] = useState(state.post);
+ const [postData, setPostData] = useState(state?.post || {});
const handleCommentSubmit = async (e) => {
e.preventDefault();
@@ -78,7 +80,7 @@ export function PostDetailsCard() {
window.history.back();
};
return (
-
+