Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 662 Rev 3071
Línea -... Línea 1...
-
 
1
/* eslint-disable react/prop-types */
1
import React from "react";
2
import React from "react";
2
import { useRef, useState, useEffect } from "react";
3
import { useRef, useState, useEffect } from "react";
3
import { useForm } from "react-hook-form";
4
import { useForm } from "react-hook-form";
4
import styled from "styled-components";
5
import styled from "styled-components";
5
import {axios} from "../../../../utils";
6
import { axios } from "../../../../utils";
6
import FormErrorFeedback from "../../../../shared/form-error-feedback/FormErrorFeedback";
7
import FormErrorFeedback from "../../../../shared/form-error-feedback/FormErrorFeedback";
7
import Recaptcha from "react-recaptcha";
8
import Recaptcha from "react-recaptcha";
8
import Spinner from "../../../../shared/loading-spinner/Spinner";
9
import Spinner from "../../../../shared/loading-spinner/Spinner";
9
import { Link } from "react-router-dom";
10
import { Link } from "react-router-dom";
10
import CryptoJSAesJson from "../../../../utils/crypto-js/cryptojs-aes-format";
11
import CryptoJSAesJson from "../../../../utils/crypto-js/cryptojs-aes-format";
Línea 65... Línea 66...
65
  const signupExpiredCallbackHandler = () => {
66
  const signupExpiredCallbackHandler = () => {
66
    reCaptchaToken.current = "";
67
    reCaptchaToken.current = "";
67
    setIsVerified(false);
68
    setIsVerified(false);
68
  };
69
  };
Línea 69... Línea 70...
69
 
70
 
70
  const onSubmitHandler = async (data, e) => {
-
 
71
    console.log("data");
-
 
72
    console.log(data);
71
  const onSubmitHandler = async (data) => {
73
    setIsLoading(true);
72
    setIsLoading(true);
74
    const formData = new FormData();
73
    const formData = new FormData();
75
    Object.entries(data).map(([key, value]) => {
74
    Object.entries(data).map(([key, value]) => {
76
      if (key === "email" && value)
75
      if (key === "email" && value)
Línea 92... Línea 91...
92
      } else {
91
      } else {
93
        const resError = resData.data;
92
        const resError = resData.data;
94
        if (resError.constructor.name === "Object") {
93
        if (resError.constructor.name === "Object") {
95
          Object.entries(resError).map(([key, value]) => {
94
          Object.entries(resError).map(([key, value]) => {
96
            // if (key in getValues()) {
95
            // if (key in getValues()) {
97
              setError(key, {
96
            setError(key, {
98
                type: "manual",
97
              type: "manual",
99
                message: Array.isArray(value) ? value[0] : value,
98
              message: Array.isArray(value) ? value[0] : value,
100
              });
99
            });
101
            // }
100
            // }
102
          });
101
          });
103
        } else {
102
        } else {
104
          addNotification({
103
          addNotification({
105
            style: "danger",
104
            style: "danger",
Línea 108... Línea 107...
108
        }
107
        }
109
        reCaptchaInstance.current.reset();
108
        reCaptchaInstance.current.reset();
110
        signupVerifyCallbackHandler();
109
        signupVerifyCallbackHandler();
111
      }
110
      }
112
    })
111
    })
113
    .catch(err => {
112
      .catch(err => {
114
       ('>>: err > ', err)
113
        ('>>: err > ', err)
115
      addNotification({
114
        addNotification({
116
        style: "error",
115
          style: "error",
117
        msg: 'Disculpe, ha ocurrido un error',
116
          msg: 'Disculpe, ha ocurrido un error',
-
 
117
        });
-
 
118
      })
-
 
119
      .finally(() => {
-
 
120
        setIsLoading(false);
118
      });
121
      });
119
    })
-
 
120
    .finally(() => {
-
 
121
      setIsLoading(false);
-
 
122
    });
-
 
123
  };
122
  };
Línea 124... Línea 123...
124
 
123
 
125
  const handleOnRecaptchaLoad = () => {
124
  const handleOnRecaptchaLoad = () => {
126
    reCaptchaToken.current = "";
125
    reCaptchaToken.current = "";
Línea 272... Línea 271...
272
                      required: "Este campo es requerido",
271
                      required: "Este campo es requerido",
273
                    })}
272
                    })}
274
                    value="1"
273
                    value="1"
275
                    readOnly
274
                    readOnly
276
                  />
275
                  />
277
                  <label
-
 
278
                    forhtml="terms_and_conditions"
-
 
279
                    onClick={() => {
-
 
280
                      setTermsChecked(!termsChecked);
276
                  <label htmlFor="terms_and_conditions" onClick={() => setTermsChecked(!termsChecked)}>
281
                    }}
-
 
282
                  >
-
 
283
                    <span></span>
277
                    <span></span>
284
                  </label>
278
                  </label>
285
                  <small
-
 
286
                    onClick={() => {
-
 
287
                      setTermsChecked(!termsChecked);
279
                  <small onClick={() => setTermsChecked(!termsChecked)}>
288
                    }}
280
                    Si, entiendo y acepto las
289
                  >
-
 
290
                    Si, entiendo y acepto las Condiciones y Términos
281
                    <a href="/terms-and-conditions">Condiciones y Términos</a>
291
                  </small>
282
                  </small>
292
                </div>
283
                </div>
293
                {/* <!--fgt-sec end--> */}
284
                {/* <!--fgt-sec end--> */}
294
              </div>
285
              </div>
295
              {errors.terms_and_conditions && (
286
              {errors.terms_and_conditions && (