mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 14:08:11 +00:00
Build issues resolution
This commit is contained in:
@@ -6,7 +6,7 @@ export const bookingsApi = {
|
||||
getAll: async (params?: any) => {
|
||||
const cleanParams = Object.fromEntries(
|
||||
Object.entries(params || {}).filter(([_, value]) => value !== '' && value !== undefined && value !== null)
|
||||
);
|
||||
) as Record<string, string>;
|
||||
const query = new URLSearchParams(cleanParams).toString();
|
||||
const response = await apiClient.get<any>(`/bookings${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
@@ -24,7 +24,7 @@ export const passengersApi = {
|
||||
getAll: async (params?: any) => {
|
||||
const cleanParams = Object.fromEntries(
|
||||
Object.entries(params || {}).filter(([_, value]) => value !== '' && value !== undefined && value !== null)
|
||||
);
|
||||
) as Record<string, string>;
|
||||
const query = new URLSearchParams(cleanParams).toString();
|
||||
const response = await apiClient.get<any>(`/passengers${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
@@ -40,7 +40,7 @@ export const stationsApi = {
|
||||
getAll: async (params?: any) => {
|
||||
const cleanParams = Object.fromEntries(
|
||||
Object.entries(params || {}).filter(([_, value]) => value !== '' && value !== undefined && value !== null)
|
||||
);
|
||||
) as Record<string, string>;
|
||||
const query = new URLSearchParams(cleanParams).toString();
|
||||
const response = await apiClient.get<any>(`/stations${query ? `?${query}` : ''}`);
|
||||
// Handle wrapped response: { success, data: [...], timestamp }
|
||||
@@ -60,7 +60,7 @@ export const fleetApi = {
|
||||
getTrains: async (params?: any) => {
|
||||
const cleanParams = Object.fromEntries(
|
||||
Object.entries(params || {}).filter(([_, value]) => value !== '' && value !== undefined && value !== null)
|
||||
);
|
||||
) as Record<string, string>;
|
||||
const query = new URLSearchParams(cleanParams).toString();
|
||||
const response = await apiClient.get<any>(`/fleet/trains${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
@@ -71,7 +71,7 @@ export const fleetApi = {
|
||||
getCoaches: async (params?: any) => {
|
||||
const cleanParams = Object.fromEntries(
|
||||
Object.entries(params || {}).filter(([_, value]) => value !== '' && value !== undefined && value !== null)
|
||||
);
|
||||
) as Record<string, string>;
|
||||
const query = new URLSearchParams(cleanParams).toString();
|
||||
const response = await apiClient.get<any>(`/fleet/coaches${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
@@ -90,7 +90,7 @@ export const fleetApi = {
|
||||
// Schedules API
|
||||
export const schedulesApi = {
|
||||
getAll: async (params?: any) => {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const response = await apiClient.get<any>(`/schedules${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
@@ -125,7 +125,7 @@ export const seatsApi = {
|
||||
// Payments API
|
||||
export const paymentsApi = {
|
||||
getAll: async (params?: any) => {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const response = await apiClient.get<any>(`/payments${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
@@ -140,7 +140,7 @@ export const paymentsApi = {
|
||||
// Tickets API
|
||||
export const ticketsApi = {
|
||||
getAll: async (params?: any) => {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const response = await apiClient.get<any>(`/tickets${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
@@ -155,7 +155,7 @@ export const ticketsApi = {
|
||||
// Agents API
|
||||
export const agentsApi = {
|
||||
getAll: async (params?: any) => {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const response = await apiClient.get<any>(`/agents${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
@@ -174,7 +174,7 @@ export const agentsApi = {
|
||||
// Loyalty API
|
||||
export const loyaltyApi = {
|
||||
getAccounts: async (params?: any) => {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const response = await apiClient.get<any>(`/loyalty/accounts${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
@@ -190,7 +190,7 @@ export const loyaltyApi = {
|
||||
// Wallet API
|
||||
export const walletApi = {
|
||||
getAccounts: async (params?: any) => {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const response = await apiClient.get<any>(`/wallet/accounts${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
@@ -205,7 +205,7 @@ export const walletApi = {
|
||||
// Promotions API
|
||||
export const promotionsApi = {
|
||||
getAll: async (params?: any) => {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const response = await apiClient.get<any>(`/promos${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
@@ -221,7 +221,7 @@ export const promotionsApi = {
|
||||
// Support API
|
||||
export const supportApi = {
|
||||
getConversations: async (params?: any) => {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const response = await apiClient.get<any>(`/support/conversations${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
@@ -242,7 +242,7 @@ export const notificationsApi = {
|
||||
updateTemplate: (id: string, data: any) => apiClient.patch<any>(`/notifications/templates/${id}`, data),
|
||||
send: (data: any) => apiClient.post<any>('/notifications/send', data),
|
||||
getHistory: async (params?: any) => {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const response = await apiClient.get<any>(`/notifications/history${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
@@ -254,7 +254,7 @@ export const notificationsApi = {
|
||||
// Fraud API
|
||||
export const fraudApi = {
|
||||
getAlerts: async (params?: any) => {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const response = await apiClient.get<any>(`/fraud/alerts${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
@@ -270,7 +270,7 @@ export const fraudApi = {
|
||||
// Verifayda API
|
||||
export const verifaydaApi = {
|
||||
getVerifications: async (params?: any) => {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const response = await apiClient.get<any>(`/passengers/verifications${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
@@ -284,7 +284,7 @@ export const verifaydaApi = {
|
||||
// Audit API
|
||||
export const auditApi = {
|
||||
getLogs: async (params?: any) => {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const response = await apiClient.get<any>(`/audit/logs${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
@@ -316,7 +316,7 @@ export const foodApi = {
|
||||
getCategories: () => apiClient.get<any[]>('/food/categories'),
|
||||
getMenuItems: (scheduleId: string) => apiClient.get<any[]>(`/food/menu/${scheduleId}`),
|
||||
getOrders: async (params?: any) => {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const response = await apiClient.get<any>(`/food/orders${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
@@ -330,7 +330,7 @@ export const foodApi = {
|
||||
// Reports API
|
||||
export const reportsApi = {
|
||||
getOperationalReports: async (params?: any) => {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const response = await apiClient.get<any>(`/reports/operational${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
|
||||
Reference in New Issue
Block a user