Skip to content

Commit b0d3534

Browse files
committed
Fix: pass session fetch to submitGoalSetup helper
1 parent fcec2f7 commit b0d3534

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/ui/components/goal-setup/GoalSetupSurface.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ function cx(...classes: Array<string | false | null | undefined>): string {
4848
return classes.filter(Boolean).join(' ');
4949
}
5050

51-
async function submitGoalSetup(payload: unknown): Promise<void> {
52-
const response = await fetch('/api/goal-setup/submit', {
51+
async function submitGoalSetup(payload: unknown, fetchFn: (input: string, init?: RequestInit) => Promise<Response> = fetch): Promise<void> {
52+
const response = await fetchFn('/api/goal-setup/submit', {
5353
method: 'POST',
5454
headers: { 'Content-Type': 'application/json' },
5555
body: JSON.stringify(payload),
@@ -255,7 +255,7 @@ const InterviewSurface = React.forwardRef<GoalSetupSurfaceHandle, {
255255
title: bundle.title,
256256
goalSlug: bundle.goalSlug,
257257
answers: answerList,
258-
});
258+
}, fetch);
259259
setSubmitState('submitted');
260260
onSubmitted?.();
261261
} catch (err) {
@@ -880,7 +880,7 @@ const FactsSurface = React.forwardRef<GoalSetupSurfaceHandle, {
880880
title: bundle.title,
881881
goalSlug: bundle.goalSlug,
882882
facts: factsToSubmit,
883-
});
883+
}, fetch);
884884
setSubmitState('submitted');
885885
onSubmitted?.();
886886
} catch (err) {

0 commit comments

Comments
 (0)