Create usePolling custom hook

This commit is contained in:
Ken Hibino
2020-11-29 15:04:24 -08:00
parent b9cb9211ce
commit 3dd6fdc0b0
10 changed files with 53 additions and 47 deletions

View File

@@ -133,11 +133,14 @@ export type TasksActionTypes =
| ListDeadTasksSuccessAction
| ListDeadTasksErrorAction;
export function listActiveTasksAsync(qname: string) {
export function listActiveTasksAsync(
qname: string,
pageOpts?: PaginationOptions
) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: LIST_ACTIVE_TASKS_BEGIN, queue: qname });
try {
const response = await listActiveTasks(qname);
const response = await listActiveTasks(qname, pageOpts);
dispatch({
type: LIST_ACTIVE_TASKS_SUCCESS,
queue: qname,