mirror of
https://github.com/cupcakearmy/obolus.git
synced 2025-12-11 00:54:58 +00:00
prevent page reload and split code
This commit is contained in:
@@ -17,11 +17,16 @@ const List = ({ fetched }) => {
|
||||
input.current.focus()
|
||||
}, [input])
|
||||
|
||||
const _submit = () => callAPI(null, {
|
||||
url: `/api/items/`,
|
||||
method: 'post',
|
||||
data: { text },
|
||||
}).then(refresh)
|
||||
const _submit = async (e) => {
|
||||
e.preventDefault()
|
||||
await callAPI(null, {
|
||||
url: `/api/items/`,
|
||||
method: 'post',
|
||||
data: { text },
|
||||
})
|
||||
setText('')
|
||||
refresh()
|
||||
}
|
||||
|
||||
const _clear = () => callAPI(null, {
|
||||
url: `/api/items/`,
|
||||
|
||||
Reference in New Issue
Block a user