Skip to content

Commit

Permalink
fix: build error3
Browse files Browse the repository at this point in the history
  • Loading branch information
jiohjung98 committed Aug 28, 2024
1 parent e944099 commit 75b4251
Showing 1 changed file with 53 additions and 53 deletions.
106 changes: 53 additions & 53 deletions src/app/notifyAll/page.tsx
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
import axios from "axios";
// import axios from "axios";

interface Notification {
notifyId: number;
title: string;
content: string | null;
senderProfileImgAccessUri: string;
senderNickName: string;
notificationType: "LIKE" | "COMMENT" | "FOLLOW";
createdAt: string;
read: boolean;
}
let accessToken = "";
// interface Notification {
// notifyId: number;
// title: string;
// content: string | null;
// senderProfileImgAccessUri: string;
// senderNickName: string;
// notificationType: "LIKE" | "COMMENT" | "FOLLOW";
// createdAt: string;
// read: boolean;
// }
// let accessToken = "";

async function fetchNotifications(): Promise<Notification[]> {
const response = await axios.get(
`${process.env.NEXT_PUBLIC_API_URL}/api/notify`
);
return response.data;
}
// async function fetchNotifications(): Promise<Notification[]> {
// const response = await axios.get(
// `${process.env.NEXT_PUBLIC_API_URL}/api/notify`
// );
// return response.data;
// }

export default async function NotificationsPage() {
const notifications = await fetchNotifications();
// export default async function NotificationsPage() {
// const notifications = await fetchNotifications();

return (
<div className="p-4">
<h1 className="text-2xl font-bold mb-4">All Notifications</h1>
<ul>
{notifications.map((notification) => (
<li
key={notification.notifyId}
className="flex items-center mb-4 p-4 rounded-md shadow-lg"
>
<img
src={notification.senderProfileImgAccessUri}
alt="Profile"
className="w-10 h-10 rounded-full mr-4"
/>
<div>
<p className="font-semibold">{notification.title}</p>
{notification.notificationType === "COMMENT" &&
notification.content && (
<p className="text-sm text-gray-600">
{truncateText(notification.content, 30)}
</p>
)}
</div>
</li>
))}
</ul>
</div>
);
}
// return (
// <div className="p-4">
// <h1 className="text-2xl font-bold mb-4">All Notifications</h1>
// <ul>
// {notifications.map((notification) => (
// <li
// key={notification.notifyId}
// className="flex items-center mb-4 p-4 rounded-md shadow-lg"
// >
// <img
// src={notification.senderProfileImgAccessUri}
// alt="Profile"
// className="w-10 h-10 rounded-full mr-4"
// />
// <div>
// <p className="font-semibold">{notification.title}</p>
// {notification.notificationType === "COMMENT" &&
// notification.content && (
// <p className="text-sm text-gray-600">
// {truncateText(notification.content, 30)}
// </p>
// )}
// </div>
// </li>
// ))}
// </ul>
// </div>
// );
// }

const truncateText = (text: string, length: number) => {
if (text.length <= length) return text;
return text.substring(0, length) + "...";
};
// const truncateText = (text: string, length: number) => {
// if (text.length <= length) return text;
// return text.substring(0, length) + "...";
// };

0 comments on commit 75b4251

Please sign in to comment.