update project & fix default value add rainfall
This commit is contained in:
1 parent
857126ffb8
commit
7ff0470e48
4 files changed
+1052
-1082
No files matched your search
@@ -7,14 +7,14 @@ const AddRainfall: FC<AddRainfallProps> = ({reload}) => {
|
||||
|
||||
const {errorCatch, errorLabel, axiosPost} = useAxiosTools()
|
||||
const [date, setDate] = useState((new Date()).toSQLDate())
|
||||
const [value, setValue] = useState(0)
|
||||
const [value, setValue] = useState<null|number>(null)
|
||||
|
||||
const handleSubmit = async (event: FormEvent) => {
|
||||
event.preventDefault()
|
||||
try {
|
||||
await axiosPost('/api/rainfalls', {date, value})
|
||||
setDate((new Date()).toSQLDate())
|
||||
setValue(0)
|
||||
setValue(null)
|
||||
reload(new Date())
|
||||
} catch (error) {
|
||||
errorCatch(error)
|
||||
|
||||
Reference in new issue
Block a user