summaryrefslogtreecommitdiff
path: root/makima/frontend/src/hooks/useDirectives.ts
diff options
context:
space:
mode:
Diffstat (limited to 'makima/frontend/src/hooks/useDirectives.ts')
-rw-r--r--makima/frontend/src/hooks/useDirectives.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/makima/frontend/src/hooks/useDirectives.ts b/makima/frontend/src/hooks/useDirectives.ts
index 7e26ec4..18544da 100644
--- a/makima/frontend/src/hooks/useDirectives.ts
+++ b/makima/frontend/src/hooks/useDirectives.ts
@@ -21,6 +21,7 @@ import {
updateDirectiveGoal,
cleanupDirectiveTasks,
pickUpOrders as pickUpOrdersApi,
+ createDirectivePR,
} from "../lib/api";
export function useDirectives() {
@@ -185,6 +186,12 @@ export function useDirective(id: string | undefined) {
return result;
}, [id, refresh]);
+ const createPR = useCallback(async () => {
+ if (!id) return;
+ await createDirectivePR(id);
+ await refresh();
+ }, [id, refresh]);
+
return {
directive, loading, error, refresh,
update, addStep, removeStep,
@@ -192,5 +199,6 @@ export function useDirective(id: string | undefined) {
completeStep, failStep, skipStep,
updateGoal, cleanupTasks,
pickUpOrders: pickUpOrdersFn,
+ createPR,
};
}