refactor: 优化分页存储架构和缓存逻辑...
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user