MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / handleSubmit

Function handleSubmit

apps/web/ui/MessageForm/index.tsx:205–227  ·  view source on GitHub ↗
(event: React.SyntheticEvent, callback?: any)

Source from the content-addressed store, hash-verified

203 }, [message]);
204
205 const handleSubmit = async (event: React.SyntheticEvent, callback?: any) => {
206 event.preventDefault();
207 event.stopPropagation();
208 if (!message || loading) {
209 return;
210 }
211 setLoading(true);
212
213 callback?.(
214 postprocess(message, allUsers),
215 uploads.filter((upload) => !message.includes(upload.url))
216 )
217 .then(() => {
218 setLoading(false);
219 })
220 .catch((exception: any) => {
221 Toast.error(
222 exception?.message || 'Something went wrong. Please try again.'
223 );
224 setLoading(false);
225 });
226 setMessage('');
227 };
228 const handleSend = async (event: React.SyntheticEvent) =>
229 handleSubmit(event, onSend);
230

Callers 1

handleSendFunction · 0.70

Calls 3

postprocessFunction · 0.90
errorMethod · 0.65
callbackFunction · 0.50

Tested by

no test coverage detected