refactor: 优化分页存储架构和缓存逻辑...

This commit is contained in:
zdl
2025-11-06 01:20:07 +08:00
parent c5d6247f49
commit a5e001d975
6 changed files with 295 additions and 249 deletions

View File

@@ -37,10 +37,12 @@ const apiRequest = async (url, options = {}) => {
export const eventService = {
getEvents: (params = {}) => {
// Filter out empty params
const cleanParams = Object.fromEntries(Object.entries(params).filter(([_, v]) => v != null && v !== ''));
// Filter out null, undefined, and empty strings (but keep 0 and false)
const cleanParams = Object.fromEntries(
Object.entries(params).filter(([_, v]) => v !== null && v !== undefined && v !== '')
);
const query = new URLSearchParams(cleanParams).toString();
return apiRequest(`/api/events/?${query}`);
return apiRequest(`/api/events?${query}`);
},
getHotEvents: (params = {}) => {
const query = new URLSearchParams(params).toString();