-
+
{user}
diff --git a/src/components/molecules/PostCommentBox/index.tsx b/src/components/molecules/PostCommentBox/index.tsx
index f686547e..8878280b 100644
--- a/src/components/molecules/PostCommentBox/index.tsx
+++ b/src/components/molecules/PostCommentBox/index.tsx
@@ -32,6 +32,7 @@ import {
import { IoMdCode } from 'react-icons/io'
import NestedCommentModal from '../nestedCommentModal'
import useDeviceType from '@/hooks/useDeviceType'
+import { formatDistanceToNow } from 'date-fns'
dayjs.extend(relativeTime)
type Props = {
@@ -314,18 +315,18 @@ const PostCommentBox = ({ showCommentSec, postID, type, data }: Props) => {
{comment?.commenterId?.firstName}
-
{comment?.commenterProfileId?.university_name}
-
{`${comment?.commenterProfileId?.study_year}nd Yr ${comment?.commenterProfileId?.degree}`}
+ {/*
{comment?.commenterProfileId?.university_name}
*/}
+
{`${comment?.commenterProfileId?.study_year} year, ${comment?.commenterProfileId?.degree}`}
- {comment.createdAt && dayjs(new Date(comment?.createdAt).toString()).format('h:mm A ยท MMM D, YYYY')}
+ {comment.createdAt && formatDistanceToNow(comment?.createdAt as unknown as Date, { addSuffix: true })}
diff --git a/src/components/organisms/PostsContainer/index.tsx b/src/components/organisms/PostsContainer/index.tsx
index 52d36a60..b4981ea8 100644
--- a/src/components/organisms/PostsContainer/index.tsx
+++ b/src/components/organisms/PostsContainer/index.tsx
@@ -1,5 +1,6 @@
'use client'
import Loading from '@/app/register/loading'
+import Card from '@/components/atoms/Card'
import PostImageSlider from '@/components/atoms/PostImageSlider'
import { openImageModal } from '@/components/molecules/ImageWrapper/ImageManager'
import PostCard from '@/components/molecules/PostCard'
@@ -53,6 +54,7 @@ const ProfilePostContainer = ({ userId = '', containerRef }: Props) => {
}, [imageCarasol])
const renderPostWithRespectToPathName = () => {
+ if (userSelfPosts?.length === 0) return
No Post Available
return userSelfPosts?.map((post: communityPostType, idx: number) => (
diff --git a/src/content/constant.ts b/src/content/constant.ts
new file mode 100644
index 00000000..8da1c301
--- /dev/null
+++ b/src/content/constant.ts
@@ -0,0 +1,3 @@
+export const MESSAGES = {
+ SOMETHING_WENT_WRONG: 'Something went wrong',
+}
diff --git a/src/services/auth.ts b/src/services/auth.ts
index 86208291..b1736d0c 100644
--- a/src/services/auth.ts
+++ b/src/services/auth.ts
@@ -4,6 +4,8 @@ import { client } from './api-Client'
import { useUniStore } from '@/store/store'
import useCookie from '@/hooks/useCookie'
import { useRouter } from 'next/navigation'
+import { showCustomDangerToast } from '@/components/atoms/CustomToasts/CustomToasts'
+import { MESSAGES } from '@/content/constant'
interface data {
email: string
@@ -77,6 +79,10 @@ export const useHandleLogin = () => {
setCookieValue(response.tokens.access.token, response.tokens.access.expires)
setRefreshCookieValue(response.tokens.refresh.token, response.tokens.refresh.expires)
},
+ onError: (error: any) => {
+ console.log(error)
+ showCustomDangerToast(error.response.data.message || MESSAGES.SOMETHING_WENT_WRONG)
+ },
})
}