- Fitur notifikasi ke admin dari user baru - Notifikasi ke user bahwa akunnya telah terverifikasi Fix: - app/(application)/(user)/notifications/index.tsx - app/(application)/(user)/waiting-room.tsx - app/(application)/admin/super-admin/[id]/index.tsx - app/(application)/admin/user-access/[id]/index.tsx - context/AuthContext.tsx - screens/Home/tabsList.ts - service/api-admin/api-admin-user-access.ts - service/api-device-token.ts - service/api-notifications.ts - types/type-notification-category.ts Add: - lib/routeApp.ts ### No Issue
52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
import { apiConfig } from "./api-config";
|
|
|
|
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,
|
|
});
|
|
|
|
return response.data;
|
|
} catch (error) {
|
|
console.error("Failed to register device token:", error);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiDeviceTokenDeleted({ userId, deviceId }: { userId: string, deviceId: string }) {
|
|
try {
|
|
const response = await apiConfig.delete(
|
|
`/mobile/auth/device-tokens/${userId}?deviceId=${deviceId}`
|
|
);
|
|
|
|
return response.data;
|
|
} catch (error) {
|
|
console.error("Failed to delete device token:", error);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiGetAllTokenDevice() {
|
|
try {
|
|
const response = await apiConfig.get(`/mobile/auth/device-tokens`);
|
|
|
|
return response.data;
|
|
} catch (error) {
|
|
console.error("Failed to delete device token:", error);
|
|
throw error;
|
|
}
|
|
}
|