MCPcopy Create free account
hub / github.com/coder/coder / onSubmit

Function onSubmit

site/src/modules/tasks/TaskPrompt/TaskPrompt.tsx:217–230  ·  view source on GitHub ↗
(e: React.SyntheticEvent)

Source from the content-addressed store, hash-verified

215 });
216
217 const onSubmit = async (e: React.SyntheticEvent) => {
218 e.preventDefault();
219
220 try {
221 await createTaskMutation.mutateAsync({
222 prompt,
223 });
224 setPrompt("");
225 } catch (error) {
226 const message = getErrorMessage(error, "Error creating task");
227 const detail = getErrorDetail(error) ?? "Please try again";
228 toast.error(message, { description: detail });
229 }
230 };
231
232 const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
233 // Submit form on Cmd+Enter (Mac) or Ctrl+Enter (Windows/Linux)

Callers 15

handleKeyDownFunction · 0.70
FormFunction · 0.50
AddUsersDialogFunction · 0.50
FollowUpDialogFunction · 0.50
ScheduleFormFunction · 0.50
SchedulePageFunction · 0.50
submitFunction · 0.50
AddUsersDialogFunction · 0.50
ReviewFormFunction · 0.50

Calls 2

getErrorMessageFunction · 0.90
getErrorDetailFunction · 0.90

Tested by

no test coverage detected