Penerapan ke database
Fix: - android/app/src/main/AndroidManifest.xml - app/(application)/(user)/home.tsx - components/_ShareComponent/NotificationInitializer.tsx - ios/HIPMIBadungConnect.xcodeproj/project.pbxproj - ios/HIPMIBadungConnect/Info.plist - service/api-notifications.ts ### No Issue
This commit is contained in:
@@ -1,23 +1,51 @@
|
||||
import { apiConfig } from "./api-config";
|
||||
|
||||
|
||||
type NotificationProp = {
|
||||
fcmToken: string
|
||||
title: string,
|
||||
body: Object
|
||||
}
|
||||
fcmToken: string;
|
||||
title: string;
|
||||
body: Object;
|
||||
};
|
||||
|
||||
|
||||
export async function apiNotificationsSend({ data }: { data: NotificationProp }) {
|
||||
export async function apiNotificationsSend({
|
||||
data,
|
||||
}: {
|
||||
data: NotificationProp;
|
||||
}) {
|
||||
try {
|
||||
const response = await apiConfig.post(`/mobile/notifications`, {
|
||||
data: data,
|
||||
});
|
||||
|
||||
console.log("Fecth Notif", response.data)
|
||||
console.log("Fecth Notif", response.data);
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
type DeviceTokenData = {
|
||||
fcmToken: string;
|
||||
platform: string;
|
||||
deviceId: string;
|
||||
model: string;
|
||||
appVersion: string;
|
||||
userId: string;
|
||||
};
|
||||
|
||||
export async function apiDeviceRegisterToken({
|
||||
data,
|
||||
}: {
|
||||
data: DeviceTokenData;
|
||||
}) {
|
||||
try {
|
||||
const response = await apiConfig.post(`/mobile/auth/device-tokens`, {
|
||||
data: data,
|
||||
});
|
||||
console.log("Device token registered:", response.data);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("Failed to register device token:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user