Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 2630 Rev 3432
Línea 1... Línea 1...
1
import React, { useEffect, useState } from 'react'
1
import React, { useEffect, useState } from "react";
2
import { Redirect, useParams } from 'react-router-dom'
2
import { Redirect, useParams } from "react-router-dom";
3
import { useDispatch } from 'react-redux'
3
import { useDispatch } from "react-redux";
Línea 4... Línea 4...
4
 
4
 
5
import { axios } from 'utils/index'
5
import { axios } from "utils/index";
Línea 6... Línea 6...
6
import { addNotification } from '../../redux/notification/notification.actions'
6
import { addNotification } from "../../redux/notification/notification.actions";
7
 
7
 
8
const ActiveAccount = () => {
8
const ActiveAccount = () => {
9
  const [isValidated, setIsValidated] = useState(false)
9
  const [isValidated, setIsValidated] = useState(false);
Línea 10... Línea 10...
10
  const dispatch = useDispatch()
10
  const dispatch = useDispatch();
11
  const { uuid } = useParams()
11
  const { uuid } = useParams();
12
 
12
 
13
  useEffect(() => {
13
  useEffect(() => {
14
    const activeAccount = async () => {
14
    const activeAccount = async () => {
Línea 15... Línea 15...
15
      try {
15
      try {
16
        const { data: response } = await axios.get(`/activate-account/${uuid}`)
16
        const response = await axios.get(`/activate-account/${uuid}`);
17
        const { data, success } = response
17
        const { data, success } = response.data;
Línea 18... Línea 18...
18
 
18
 
19
        if (!success) {
19
        if (!success) {
20
          throw new Error(data)
20
          throw new Error(data);
21
        }
21
        }
22
 
22
 
23
        dispatch(addNotification({ style: 'success', msg: data }))
23
        dispatch(addNotification({ style: "success", msg: data }));
24
      } catch (error) {
24
      } catch (error) {
25
        console.log(error)
25
        console.log(error);
Línea 26... Línea 26...
26
        dispatch(addNotification({ style: 'danger', msg: error.message }))
26
        dispatch(addNotification({ style: "danger", msg: error.message }));
27
      } finally {
27
      } finally {
Línea 28... Línea 28...
28
        setIsValidated(true)
28
        setIsValidated(true);
29
      }
29
      }
30
    }
30
    };
Línea 31... Línea 31...
31
 
31
 
32
    activeAccount()
32
    activeAccount();
Línea 33... Línea 33...
33
  }, [uuid])
33
  }, [uuid]);