Add types for TaskType to TaskHook

Pre-commit

Apply better naming to task api hooks

Lint
This commit is contained in:
rjmacarthy
2023-01-27 19:09:28 +00:00
parent e6009933db
commit bf77d4dc60
3 changed files with 31 additions and 4 deletions
+3 -3
View File
@@ -4,7 +4,7 @@ import { TaskEmptyState } from "src/components/EmptyState";
import { LoadingScreen } from "src/components/Loading/LoadingScreen";
import { Task } from "src/components/Tasks/Task";
import { TaskInfos } from "src/components/Tasks/TaskTypes";
import { apiHooksByType, ERROR_CODES } from "src/lib/constants";
import { ERROR_CODES, taskApiHooks } from "src/lib/constants";
import { getTypeSafei18nKey } from "src/lib/i18n";
import { TaskType } from "src/types/Task";
@@ -14,8 +14,8 @@ type TaskPageProps = {
export const TaskPage = ({ type }: TaskPageProps) => {
const { t } = useTranslation(["tasks", "common"]);
const apiHook = apiHooksByType[type];
const { tasks, isLoading, reset, trigger, error } = apiHook(type);
const taskApiHook = taskApiHooks[type];
const { tasks, isLoading, reset, trigger, error } = taskApiHook(type);
const taskInfo = TaskInfos.find((taskType) => taskType.type === type);
if (isLoading) {