Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 1989 Rev 1990
Línea 16... Línea 16...
16
  z-index: 300;
16
  z-index: 300;
17
`;
17
`;
18
function CloseAccount() {
18
function CloseAccount() {
19
    const [showInputCode, setShowInputCode] = useState(false);
19
    const [showInputCode, setShowInputCode] = useState(false);
20
    const [loading, setLoading] = useState(false);
20
    const [loading, setLoading] = useState(false);
21
    const handleGetCode  = async () => {
21
    const handleGetCode  = async (changeState = true) => {
22
        try {
22
        try {
-
 
23
            setLoading(true)
23
            const res = await axios.get('/account-settings/deleteAccount');
24
            const res = await axios.get('/account-settings/delete-account');
24
            console.log('>>: res > ', res)
25
            console.log('>>: res > ', res)
25
            // setShowInputCode(true)
-
 
26
            console.log('>>: get code')        
26
            console.log('>>: get code')        
-
 
27
            if(changeState)
-
 
28
                setShowInputCode(true)
27
        } catch (error) {
29
        } catch (error) {
28
            console.log('>>: error > ', error)
30
            console.log('>>: error > ', error)
-
 
31
        }finally{
-
 
32
            setLoading(false)
29
        }
33
        }
30
    }
34
    }
-
 
35
 
31
    const handleSubmit = (e) => {
36
    const handleSubmit = async (e) => {
32
        try {
37
        try {
-
 
38
            e.preventDefault()
33
            setLoading(true)
39
            setLoading(true)
-
 
40
            const res = await axios.post('/account-settings/delete-account');
34
            e.preventDefault();
41
            console.log('>>: res > ', res)
35
 
-
 
36
        } catch (error) {
42
        } catch (error) {
37
            console.log('>>: error > ', error)
43
            console.log('>>: error > ', error)
38
        }finally{
44
        }finally{
39
            setLoading(false)
45
            setLoading(false)
40
        }
46
        }
Línea 45... Línea 51...
45
            return <form onSubmit={handleSubmit}>
51
            return <form onSubmit={handleSubmit}>
46
                <div className="form-group">
52
                <div className="form-group">
47
                    <label htmlFor="exampleInputEmail1">Ingrese el codigo</label>
53
                    <label htmlFor="exampleInputEmail1">Ingrese el codigo</label>
48
                    <input type="email" className="form-control" id="exampleInputEmail1" />
54
                    <input type="email" className="form-control" id="exampleInputEmail1" />
49
                    <small id="emailHelp" className="form-text text-muted">Este codigo fue enviado a tu correo electrónico.</small>
55
                    <small id="emailHelp" className="form-text text-muted">Este codigo fue enviado a tu correo electrónico.</small>
-
 
56
                    <button className="btn btn-secondary btn-sm" onClick={handleGetCode(false)}>
-
 
57
                        ¿No ha recibido su correo?, solicitue un codigo nuevo
-
 
58
                    </button>
50
                </div>
59
                </div>
51
                <button type="submit" className="btn btn-primary">Enviar</button>
60
                <button type="submit" className="btn btn-primary">Enviar</button>
52
            </form>
61
            </form>
53
        }else{
62
        }else{
54
            return <>
63
            return <>