Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4411 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 4411 Rev 4412
Línea 18... Línea 18...
18
}) => {
18
}) => {
Línea 19... Línea 19...
19
 
19
 
20
  const [loading, setLoading] = useState(false);
20
  const [loading, setLoading] = useState(false);
Línea 21... Línea 21...
21
  const [isAdult, setIsAdult] = useState(false);
21
  const [isAdult, setIsAdult] = useState(false);
Línea 22... Línea 22...
22
 
22
 
23
  const { register, handleSubmit, setValue, watch, errors } = useForm()
23
  const { register, handleSubmit, setValue, watch, errors, getValues } = useForm()
24
 
24
 
25
  useEffect(() => {
25
  useEffect(() => {
Línea 56... Línea 56...
56
      .get("/account-settings/basic")
56
      .get("/account-settings/basic")
57
      .then(({ data: response }) => {
57
      .then(({ data: response }) => {
58
        if (response.success) {
58
        if (response.success) {
59
          Object
59
          Object
60
            .entries(response.data)
60
            .entries(response.data)
61
            .map(([key, value]) =>
61
            .map(([key, value]) => {
-
 
62
              const currentValue = getValues(key)
-
 
63
              
62
              key === 'is_adult'
64
              if (key === 'is_adult') {
63
                ? setIsAdult(value === 'y' ? true : false)
65
                return setIsAdult(value === 'y' ? true : false)
-
 
66
              }
-
 
67
 
-
 
68
              if (!currentValue) {
-
 
69
                register(key, { required: true })
-
 
70
              }
-
 
71
 
64
                : setValue(key, value)
72
              setValue(key, value)
65
            )
73
            })
66
        }
74
        }
67
      })
75
      })
68
      .finally(() => setLoading(false))
76
      .finally(() => setLoading(false))
69
  }, []);
77
  }, []);