- Updated configuration to enforce Redis caching for notified articles, removing memory cache options. - Enhanced wallamonitor.py to load Redis cache settings and handle errors more effectively. - Implemented new API endpoints for clearing Redis cache and retrieving Telegram forum topics. - Improved frontend components to support fetching and displaying available Telegram threads. - Added functionality for clearing cache from the UI, ensuring better management of notified articles.
86 lines
1.7 KiB
JavaScript
86 lines
1.7 KiB
JavaScript
import axios from 'axios';
|
|
|
|
const api = axios.create({
|
|
baseURL: '/api',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
});
|
|
|
|
export default {
|
|
// Estadísticas
|
|
async getStats() {
|
|
const response = await api.get('/stats');
|
|
return response.data;
|
|
},
|
|
|
|
// Workers
|
|
async getWorkers() {
|
|
const response = await api.get('/workers');
|
|
return response.data;
|
|
},
|
|
|
|
async updateWorkers(workers) {
|
|
const response = await api.put('/workers', workers);
|
|
return response.data;
|
|
},
|
|
|
|
// Favoritos
|
|
async getFavorites() {
|
|
const response = await api.get('/favorites');
|
|
return response.data;
|
|
},
|
|
|
|
async addFavorite(favorite) {
|
|
const response = await api.post('/favorites', favorite);
|
|
return response.data;
|
|
},
|
|
|
|
async removeFavorite(platform, id) {
|
|
const response = await api.delete(`/favorites/${platform}/${id}`);
|
|
return response.data;
|
|
},
|
|
|
|
// Artículos
|
|
async getArticles(limit = 100, offset = 0) {
|
|
const response = await api.get('/articles', {
|
|
params: { limit, offset },
|
|
});
|
|
return response.data;
|
|
},
|
|
|
|
async searchArticles(query) {
|
|
const response = await api.get('/articles/search', {
|
|
params: { q: query },
|
|
});
|
|
return response.data;
|
|
},
|
|
|
|
// Logs
|
|
async getLogs(limit = 100) {
|
|
const response = await api.get('/logs', {
|
|
params: { limit },
|
|
});
|
|
return response.data;
|
|
},
|
|
|
|
// Configuración
|
|
async getConfig() {
|
|
const response = await api.get('/config');
|
|
return response.data;
|
|
},
|
|
|
|
// Telegram
|
|
async getTelegramThreads() {
|
|
const response = await api.get('/telegram/threads');
|
|
return response.data;
|
|
},
|
|
|
|
// Cache
|
|
async clearCache() {
|
|
const response = await api.delete('/cache');
|
|
return response.data;
|
|
},
|
|
};
|
|
|