TaskContext as subset of ApiHookState

This commit is contained in:
AbdBarho
2023-01-29 11:38:16 +01:00
parent d7f2a6d0d9
commit 77cc96d401
8 changed files with 45 additions and 29 deletions
@@ -6,7 +6,8 @@ import { BaseTask, ServerTaskResponse, TaskResponse, TaskType as TaskTypeEnum }
import useSWRImmutable from "swr/immutable";
import useSWRMutation from "swr/mutation";
export const useGenericTaskAPI = <TaskType extends BaseTask, ResponseContent>(
// TODO: provide type for the content reply, this will be much harder since the replies vary vastly
export const useGenericTaskAPI = <TaskType extends BaseTask, ResponseContent = any>(
taskType: TaskTypeEnum
): TaskApiHook<TaskType, ResponseContent> => {
const [response, setResponse] = useState<TaskResponse<TaskType>>({ taskAvailability: "AWAITING_INITIAL" });