mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-15 13:25:51 +00:00
refactor(frontend): 优化列表页缓存与数据刷新逻辑
1. 为详情、评论接口添加禁用缓存配置,获取实时数据 2. 重构useListPage,新增refreshData和reload方法统一数据刷新逻辑 3. 替换原有loadData调用,统一列表页数据更新流程 4. 移除冗余的force缓存配置,通过method.config自定义缓存策略
This commit is contained in:
@@ -11,8 +11,10 @@ export const NoticeAPI = {
|
||||
getPage(params?: Record<string, any>) {
|
||||
return http.Get<PageResult<NoticeItem>>(`${SYSTEM_BASE}/notice/list`, params)
|
||||
},
|
||||
getDetail(id: number): Promise<NoticeItem> {
|
||||
return http.Get(`${SYSTEM_BASE}/notice/detail/${id}`)
|
||||
getDetail(id: number) {
|
||||
const method = http.Get<NoticeItem>(`${SYSTEM_BASE}/notice/detail/${id}`)
|
||||
method.config.cacheFor = 0
|
||||
return method
|
||||
},
|
||||
create(data: NoticeForm): Promise<NoticeItem> {
|
||||
return http.Post(`${SYSTEM_BASE}/notice/create`, data)
|
||||
|
||||
@@ -10,8 +10,10 @@ export const TicketAPI = {
|
||||
getPage(params?: Record<string, any>) {
|
||||
return http.Get<PageResult<TicketItem>>(`${SYSTEM_BASE}/ticket/list`, params)
|
||||
},
|
||||
getDetail(id: number): Promise<TicketItem> {
|
||||
return http.Get(`${SYSTEM_BASE}/ticket/detail/${id}`)
|
||||
getDetail(id: number) {
|
||||
const method = http.Get<TicketItem>(`${SYSTEM_BASE}/ticket/detail/${id}`)
|
||||
method.config.cacheFor = 0
|
||||
return method
|
||||
},
|
||||
create(data: TicketForm): Promise<TicketItem> {
|
||||
return http.Post(`${SYSTEM_BASE}/ticket/create`, data)
|
||||
@@ -28,8 +30,10 @@ export const TicketAPI = {
|
||||
exportTickets(params?: Record<string, any>): Promise<unknown> {
|
||||
return http.Post(`${SYSTEM_BASE}/ticket/export`, params)
|
||||
},
|
||||
getComments(ticketId: number, params?: Record<string, any>): Promise<PageResult<TicketComment>> {
|
||||
return http.Get(`${SYSTEM_BASE}/ticket/${ticketId}/comments`, params)
|
||||
getComments(ticketId: number, params?: Record<string, any>) {
|
||||
const method = http.Get<PageResult<TicketComment>>(`${SYSTEM_BASE}/ticket/${ticketId}/comments`, params)
|
||||
method.config.cacheFor = 0
|
||||
return method
|
||||
},
|
||||
createComment(ticketId: number, data: { content: string }): Promise<TicketComment> {
|
||||
return http.Post(`${SYSTEM_BASE}/ticket/${ticketId}/comments`, data)
|
||||
|
||||
Reference in New Issue
Block a user