Fitur notifikasi dan foreground

Add:
- types/type-notification-category.ts

Fix:
- app/(application)/(user)/notifications/index.tsx
- app/(application)/(user)/test-notifications.tsx
- app/(application)/admin/notification/index.tsx
- components/Notification/NotificationInitializer.tsx
- hooks/use-notification-store.tsx
- service/api-notifications.ts
- utils/formatChatTime.ts

### No Issue
This commit is contained in:
2025-12-24 15:29:58 +08:00
parent 54611ef812
commit 7743a2467c
8 changed files with 260 additions and 89 deletions

View File

@@ -1,3 +1,4 @@
import { TypeNotificationCategoryApp } from "@/types/type-notification-category";
import { apiConfig } from "./api-config";
type NotificationProp = {
@@ -8,15 +9,7 @@ type NotificationProp = {
status?: string;
type?: "announcement" | "trigger";
deepLink?: string;
kategoriApp?:
| "JOB"
| "VOTING"
| "EVENT"
| "DONASI"
| "INVESTASI"
| "COLLABORATION"
| "FORUM"
| "ACCESS"; // Untuk trigger akses user;
kategoriApp?: TypeNotificationCategoryApp
};
export async function apiNotificationsSend({
@@ -40,7 +33,7 @@ export async function apiGetNotificationsById({
category,
}: {
id: string;
category: "count-as-unread" | "all";
category: TypeNotificationCategoryApp
}) {
console.log("ID", id);
console.log("Category", category);
@@ -68,3 +61,13 @@ export async function apiNotificationUnreadCount({ id, role }: { id: string, rol
throw error;
}
}
export async function apiNotificationMarkAsRead({id}: {id: string}) {
try {
const response = await apiConfig.put(`/mobile/notification/${id}`);
return response.data;
} catch (error) {
throw error;
}
}