fix: allow text on company number

fix: data wasn't updated after saving

fix: fixed switches on all of the operator info pages
This commit is contained in:
Liordino Neto 2020-09-24 21:12:45 -03:00 committed by Josh Harvey
parent b3290602d7
commit b997e9ecf0
4 changed files with 21 additions and 20 deletions

View file

@ -110,19 +110,10 @@ const TermsConditions = () => {
const formData = termsAndConditions ?? {}
const showOnScreen = termsAndConditions?.active ?? false
const save = it => {
setError(null)
return saveConfig({
const save = it =>
saveConfig({
variables: { config: toNamespace(namespaces.TERMS_CONDITIONS, it) }
})
}
const handleEnable = () => {
const s = !showOnScreen
save({ active: s })
}
if (!formData) return null
const fields = [
{
@ -186,7 +177,14 @@ const TermsConditions = () => {
<div className={classes.section}>
<div className={classes.enable}>
<span>Show on screen</span>
<Switch checked={showOnScreen} onChange={handleEnable} value="show" />
<Switch
checked={showOnScreen}
onChange={event =>
save({
active: event.target.checked
})
}
/>
<Label2>{showOnScreen ? 'Yes' : 'No'}</Label2>
</div>
<div className={classes.header}>
@ -200,6 +198,7 @@ const TermsConditions = () => {
)}
</div>
<Formik
enableReinitialize
initialValues={initialValues}
validationSchema={validationSchema}
onSubmit={values => save(values)}