mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-13 21:52:40 +00:00
feat: add notifications view and update branding
- Add complete notifications management view with: - Service status display (Discord, Telegram) - Test notification functionality - Service management (delete/disable) - Filter settings display (case sensitive/insensitive) - Update API types to match current backend structure - Fix NotificationFilters type (remove deprecated fields) - Update page title from 'Vite + React + TS' to 'Leggen' - Replace Vite favicon with custom Leggen favicon - Add notifications tab to main navigation - Ensure full API compatibility with current backend
This commit is contained in:
committed by
Elisiário Couto
parent
957099786c
commit
abf39abe74
@@ -1,5 +1,5 @@
|
||||
import axios from 'axios';
|
||||
import type { Account, Transaction, Balance, ApiResponse } from '../types/api';
|
||||
import type { Account, Transaction, Balance, ApiResponse, NotificationSettings, NotificationTest, NotificationService, NotificationServicesResponse } from '../types/api';
|
||||
|
||||
const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000/api/v1';
|
||||
|
||||
@@ -62,6 +62,36 @@ export const apiClient = {
|
||||
const response = await api.get<ApiResponse<Transaction>>(`/transactions/${id}`);
|
||||
return response.data.data;
|
||||
},
|
||||
|
||||
// Get notification settings
|
||||
getNotificationSettings: async (): Promise<NotificationSettings> => {
|
||||
const response = await api.get<ApiResponse<NotificationSettings>>('/notifications/settings');
|
||||
return response.data.data;
|
||||
},
|
||||
|
||||
// Update notification settings
|
||||
updateNotificationSettings: async (settings: NotificationSettings): Promise<NotificationSettings> => {
|
||||
const response = await api.put<ApiResponse<NotificationSettings>>('/notifications/settings', settings);
|
||||
return response.data.data;
|
||||
},
|
||||
|
||||
// Test notification
|
||||
testNotification: async (test: NotificationTest): Promise<void> => {
|
||||
await api.post('/notifications/test', test);
|
||||
},
|
||||
|
||||
// Get notification services
|
||||
getNotificationServices: async (): Promise<NotificationService[]> => {
|
||||
const response = await api.get<ApiResponse<NotificationServicesResponse>>('/notifications/services');
|
||||
// Convert object to array format
|
||||
const servicesData = response.data.data;
|
||||
return Object.values(servicesData);
|
||||
},
|
||||
|
||||
// Delete notification service
|
||||
deleteNotificationService: async (service: string): Promise<void> => {
|
||||
await api.delete(`/notifications/settings/${service}`);
|
||||
},
|
||||
};
|
||||
|
||||
export default apiClient;
|
||||
|
||||
Reference in New Issue
Block a user