mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-29 18:13:47 +00:00
refactor: migrate to eslint flat config and format codebase with prettier
- Remove legacy .eslintrc.cjs and .eslintignore - Add eslint.config.js with flat config, security rules (no-eval, no-implied-eval, no-new-func, no-script-url) - Add .prettierrc and .prettierignore - Format entire codebase with prettier
This commit is contained in:
@@ -1,58 +1,64 @@
|
||||
import apiClient from './client'
|
||||
import apiClient from './client';
|
||||
|
||||
export interface NotificationSettings {
|
||||
subscription_expiry_enabled: boolean
|
||||
subscription_expiry_days: number
|
||||
traffic_warning_enabled: boolean
|
||||
traffic_warning_percent: number
|
||||
balance_low_enabled: boolean
|
||||
balance_low_threshold: number
|
||||
news_enabled: boolean
|
||||
promo_offers_enabled: boolean
|
||||
subscription_expiry_enabled: boolean;
|
||||
subscription_expiry_days: number;
|
||||
traffic_warning_enabled: boolean;
|
||||
traffic_warning_percent: number;
|
||||
balance_low_enabled: boolean;
|
||||
balance_low_threshold: number;
|
||||
news_enabled: boolean;
|
||||
promo_offers_enabled: boolean;
|
||||
}
|
||||
|
||||
export interface NotificationSettingsUpdate {
|
||||
subscription_expiry_enabled?: boolean
|
||||
subscription_expiry_days?: number
|
||||
traffic_warning_enabled?: boolean
|
||||
traffic_warning_percent?: number
|
||||
balance_low_enabled?: boolean
|
||||
balance_low_threshold?: number
|
||||
news_enabled?: boolean
|
||||
promo_offers_enabled?: boolean
|
||||
subscription_expiry_enabled?: boolean;
|
||||
subscription_expiry_days?: number;
|
||||
traffic_warning_enabled?: boolean;
|
||||
traffic_warning_percent?: number;
|
||||
balance_low_enabled?: boolean;
|
||||
balance_low_threshold?: number;
|
||||
news_enabled?: boolean;
|
||||
promo_offers_enabled?: boolean;
|
||||
}
|
||||
|
||||
export const notificationsApi = {
|
||||
// Get notification settings
|
||||
getSettings: async (): Promise<NotificationSettings> => {
|
||||
const response = await apiClient.get<NotificationSettings>('/cabinet/notifications')
|
||||
return response.data
|
||||
const response = await apiClient.get<NotificationSettings>('/cabinet/notifications');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// Update notification settings
|
||||
updateSettings: async (settings: NotificationSettingsUpdate): Promise<NotificationSettings> => {
|
||||
const response = await apiClient.patch<NotificationSettings>('/cabinet/notifications', settings)
|
||||
return response.data
|
||||
const response = await apiClient.patch<NotificationSettings>(
|
||||
'/cabinet/notifications',
|
||||
settings,
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// Send test notification
|
||||
sendTestNotification: async (): Promise<{ success: boolean; message: string }> => {
|
||||
const response = await apiClient.post<{ success: boolean; message: string }>(
|
||||
'/cabinet/notifications/test'
|
||||
)
|
||||
return response.data
|
||||
'/cabinet/notifications/test',
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// Get notification history
|
||||
getHistory: async (limit = 20, offset = 0): Promise<{
|
||||
notifications: any[]
|
||||
total: number
|
||||
limit: number
|
||||
offset: number
|
||||
getHistory: async (
|
||||
limit = 20,
|
||||
offset = 0,
|
||||
): Promise<{
|
||||
notifications: unknown[];
|
||||
total: number;
|
||||
limit: number;
|
||||
offset: number;
|
||||
}> => {
|
||||
const response = await apiClient.get('/cabinet/notifications/history', {
|
||||
params: { limit, offset },
|
||||
})
|
||||
return response.data
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user