mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-22 07:29:08 +00:00
fix: prevent false error on form submit (#230)
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ontime-ui",
|
"name": "ontime-ui",
|
||||||
"version": "1.9.2",
|
"version": "1.9.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chakra-ui/react": "^2.3.2",
|
"@chakra-ui/react": "^2.3.2",
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import style from './Modals.module.scss';
|
|||||||
|
|
||||||
export default function AppSettingsModal() {
|
export default function AppSettingsModal() {
|
||||||
const { data, status, refetch } = useFetch(APP_SETTINGS, getSettings);
|
const { data, status, refetch } = useFetch(APP_SETTINGS, getSettings);
|
||||||
const { emitError, emitWarning } = useContext(LoggingContext);
|
const { emitWarning } = useContext(LoggingContext);
|
||||||
const [formData, setFormData] = useState(ontimePlaceholderSettings);
|
const [formData, setFormData] = useState(ontimePlaceholderSettings);
|
||||||
const [changed, setChanged] = useState(false);
|
const [changed, setChanged] = useState(false);
|
||||||
const [submitting, setSubmitting] = useState(false);
|
const [submitting, setSubmitting] = useState(false);
|
||||||
@@ -79,10 +79,7 @@ export default function AppSettingsModal() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set fields with error
|
if (validation.isValid) {
|
||||||
if (!validation.isValid) {
|
|
||||||
emitError(`Invalid Input: ${validation.message}`);
|
|
||||||
} else {
|
|
||||||
await postSettings(formData);
|
await postSettings(formData);
|
||||||
await refetch();
|
await refetch();
|
||||||
validation?.message && emitWarning(validation.message);
|
validation?.message && emitWarning(validation.message);
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ontime",
|
"name": "ontime",
|
||||||
"version": "1.9.2",
|
"version": "1.9.3",
|
||||||
"author": "Carlos Valente",
|
"author": "Carlos Valente",
|
||||||
"description": "Time keeping for live events",
|
"description": "Time keeping for live events",
|
||||||
"repository": "https://github.com/cpvalente/ontime",
|
"repository": "https://github.com/cpvalente/ontime",
|
||||||
|
|||||||
Reference in New Issue
Block a user