MCPcopy Create free account
hub / github.com/AlexErrant/Pentive / SubmitComment

Function SubmitComment

hub/src/components/submitComment.tsx:3–30  ·  view source on GitHub ↗
(props: {
	onSubmit: (text: string) => Promise<void>
})

Source from the content-addressed store, hash-verified

1import { commentText } from 'shared/schema'
2
3export default function SubmitComment(props: {
4 onSubmit: (text: string) => Promise<void>
5}) {
6 return (
7 <main>
8 <form
9 onSubmit={async (e) => {
10 e.preventDefault()
11 const formData = new FormData(e.target as HTMLFormElement)
12 const text = commentText.parse(formData.get('comment'))
13 // highTODO idempotency token
14 await props.onSubmit(text)
15 }}
16 >
17 <textarea
18 class='border'
19 name='comment'
20 autocomplete='off'
21 rows='4'
22 cols='50'
23 />
24 <button class='block' type='submit'>
25 Submit
26 </button>
27 </form>
28 </main>
29 )
30}

Callers

nothing calls this directly

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected