MCPcopy Create free account
hub / github.com/TryCatchLearn/Overflow / onSubmit

Function onSubmit

webapp/src/app/questions/ask/QuestionForm.tsx:40–52  ·  view source on GitHub ↗
(data: QuestionSchema)

Source from the content-addressed store, hash-verified

38 }, [questionToUpdate, reset])
39
40 const onSubmit = (data: QuestionSchema) => {
41 startTransition(async () => {
42 if (questionToUpdate) {
43 const {error} = await updateQuestion(data, questionToUpdate.id);
44 if (error) handleError(error);
45 router.push(`/questions/${questionToUpdate.id}`);
46 } else {
47 const {data: question, error} = await postQuestion(data);
48 if (error) handleError(error);
49 if (question) router.push(`/questions/${question.id}`);
50 }
51 })
52 }
53
54 return (
55 <Form onSubmit={handleSubmit(onSubmit)}

Callers

nothing calls this directly

Calls 3

updateQuestionFunction · 0.90
handleErrorFunction · 0.90
postQuestionFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…