fix: prevent false error on form submit (#230)

This commit is contained in:
Carlos Valente
2022-10-22 21:55:09 +02:00
committed by GitHub
parent 4a83f2554d
commit 45cfb633de
3 changed files with 4 additions and 7 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "ontime-ui",
"version": "1.9.2",
"version": "1.9.3",
"private": true,
"dependencies": {
"@chakra-ui/react": "^2.3.2",
@@ -29,7 +29,7 @@ import style from './Modals.module.scss';
export default function AppSettingsModal() {
const { data, status, refetch } = useFetch(APP_SETTINGS, getSettings);
const { emitError, emitWarning } = useContext(LoggingContext);
const { emitWarning } = useContext(LoggingContext);
const [formData, setFormData] = useState(ontimePlaceholderSettings);
const [changed, setChanged] = useState(false);
const [submitting, setSubmitting] = useState(false);
@@ -79,10 +79,7 @@ export default function AppSettingsModal() {
}
}
// set fields with error
if (!validation.isValid) {
emitError(`Invalid Input: ${validation.message}`);
} else {
if (validation.isValid) {
await postSettings(formData);
await refetch();
validation?.message && emitWarning(validation.message);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "ontime",
"version": "1.9.2",
"version": "1.9.3",
"author": "Carlos Valente",
"description": "Time keeping for live events",
"repository": "https://github.com/cpvalente/ontime",