Notifikasi terhubung ke DB
Add: - components/Notification/ - hooks/use-notification-store.tsx.back Fix: - app.config.js - app/(application)/(user)/_layout.tsx - app/(application)/(user)/home.tsx - app/(application)/(user)/test-notifications.tsx - app/(application)/_layout.tsx - app/_layout.tsx - components/_Icon/IconComponent.tsx - components/_Icon/IconPlus.tsx - components/_ShareComponent/NotificationInitializer.tsx - context/AuthContext.tsx - hooks/use-notification-store.tsx - ios/HIPMIBadungConnect/Info.plist - screens/Home/HeaderBell.tsx - service/api-device-token.ts - service/api-notifications.ts ### No Issue
This commit is contained in:
@@ -13,12 +13,42 @@ export async function apiNotificationsSend({
|
||||
data: NotificationProp;
|
||||
}) {
|
||||
try {
|
||||
const response = await apiConfig.post(`/mobile/notifications`, {
|
||||
const response = await apiConfig.post(`/mobile/notification`, {
|
||||
data: data,
|
||||
});
|
||||
|
||||
console.log("Fecth Notif", response.data);
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function apiGetNotificationsById({
|
||||
id,
|
||||
category,
|
||||
}: {
|
||||
id: string;
|
||||
category: "count-as-unread" | "all";
|
||||
}) {
|
||||
console.log("ID", id);
|
||||
console.log("Category", category);
|
||||
|
||||
try {
|
||||
const response = await apiConfig.get(
|
||||
`/mobile/notification/${id}?category=${category}`
|
||||
);
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function apiNotificationUnreadCount({ id }: { id: string }) {
|
||||
try {
|
||||
const response = await apiConfig.get(
|
||||
`/mobile/notification/${id}/unread-count`
|
||||
);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
|
||||
Reference in New Issue
Block a user