Extract generic useListData hook for shared list fetching
This commit is contained in:
@@ -21,8 +21,8 @@ import type {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/** Fetch all configured blocklist sources. */
|
||||
export async function fetchBlocklists(): Promise<BlocklistListResponse> {
|
||||
return get<BlocklistListResponse>(ENDPOINTS.blocklists);
|
||||
export async function fetchBlocklists(signal?: AbortSignal): Promise<BlocklistListResponse> {
|
||||
return get<BlocklistListResponse>(ENDPOINTS.blocklists, signal);
|
||||
}
|
||||
|
||||
/** Create a new blocklist source. */
|
||||
|
||||
@@ -51,8 +51,9 @@ import type {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export async function fetchJailConfigs(
|
||||
signal?: AbortSignal,
|
||||
): Promise<JailConfigListResponse> {
|
||||
return get<JailConfigListResponse>(ENDPOINTS.configJails);
|
||||
return get<JailConfigListResponse>(ENDPOINTS.configJails, signal);
|
||||
}
|
||||
|
||||
export async function fetchJailConfig(
|
||||
@@ -344,8 +345,8 @@ export async function assignFilterToJail(
|
||||
*
|
||||
* @returns FilterListResponse with all discovered filters and status.
|
||||
*/
|
||||
export async function fetchFilters(): Promise<FilterListResponse> {
|
||||
return get<FilterListResponse>(ENDPOINTS.configFilters);
|
||||
export async function fetchFilters(signal?: AbortSignal): Promise<FilterListResponse> {
|
||||
return get<FilterListResponse>(ENDPOINTS.configFilters, signal);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -385,8 +386,8 @@ export async function updateParsedAction(
|
||||
*
|
||||
* @returns ActionListResponse with all discovered actions and status.
|
||||
*/
|
||||
export async function fetchActions(): Promise<ActionListResponse> {
|
||||
return get<ActionListResponse>(ENDPOINTS.configActions);
|
||||
export async function fetchActions(signal?: AbortSignal): Promise<ActionListResponse> {
|
||||
return get<ActionListResponse>(ENDPOINTS.configActions, signal);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user