Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 7379 Rev 7380
Línea 2... Línea 2...
2
import { axios } from '../../../utils'
2
import { axios } from '../../../utils'
3
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'
3
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'
Línea 4... Línea 4...
4
 
4
 
5
import useOutsideClick from '../../../hooks/useOutsideClick'
5
import useOutsideClick from '../../../hooks/useOutsideClick'
6
import { Avatar } from '@mui/material'
6
import { Avatar } from '@mui/material'
7
import { Link } from 'react-router-dom'
7
import { Link, useHistory } from 'react-router-dom'
8
import { logout } from '../../../redux/auth/auth.actions'
8
import { logout } from '../../../redux/auth/auth.actions'
9
import { useDispatch } from 'react-redux'
9
import { useDispatch } from 'react-redux'
Línea 10... Línea 10...
10
import { addNotification } from '../../../redux/notification/notification.actions'
10
import { addNotification } from '../../../redux/notification/notification.actions'
Línea 23... Línea 23...
23
    '/storage/type/user/code/f3df3718-37d9-4e4d-bd84-71f7924a858d/'
23
    '/storage/type/user/code/f3df3718-37d9-4e4d-bd84-71f7924a858d/'
24
  )
24
  )
25
  const [displayOptions, setDisplayOptions] = useState(false)
25
  const [displayOptions, setDisplayOptions] = useState(false)
26
  const userDropdownContainer = useRef(null)
26
  const userDropdownContainer = useRef(null)
27
  const dispatch = useDispatch()
27
  const dispatch = useDispatch()
28
 
-
 
-
 
28
  const history = useHistory()
29
  useOutsideClick(userDropdownContainer, () => setDisplayOptions(false))
29
  useOutsideClick(userDropdownContainer, () => setDisplayOptions(false))
Línea 30... Línea 30...
30
 
30
 
31
  const checkUserImage = () => {
31
  const checkUserImage = () => {
Línea 57... Línea 57...
57
  const handleLogout = (e) => {
57
  const handleLogout = (e) => {
58
    e.preventDefault()
58
    e.preventDefault()
59
    axios
59
    axios
60
      .get('/signout')
60
      .get('/signout')
61
      .then((response) => {
61
      .then((response) => {
62
        const { success } = response.data
62
        const { success, data } = response.data
63
        if (!success) {
63
        if (!success) {
64
          dispatch(
64
          dispatch(
65
            addNotification({
65
            addNotification({
66
              style: 'danger',
66
              style: 'danger',
67
              msg: 'Error interno. Intente más tarde.',
67
              msg: 'Error interno. Intente más tarde.',
68
            })
68
            })
69
          )
69
          )
70
        }
70
        }
Línea -... Línea 71...
-
 
71
 
-
 
72
        if (data.url) {
-
 
73
          history.push(data.url)
-
 
74
          dispatch(
-
 
75
            addNotification({
-
 
76
              style: 'success',
-
 
77
              msg: data.message,
-
 
78
            })
-
 
79
          )
-
 
80
          return
-
 
81
        }
71
 
82
 
72
        dispatch(logout())
83
        dispatch(logout())
73
      })
84
      })
74
      .catch((err) => {
85
      .catch((err) => {
75
        dispatch(
86
        dispatch(