Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3201 Rev 3267
Línea 5... Línea 5...
5
import { ArrowDropDown } from '@mui/icons-material'
5
import { ArrowDropDown } from '@mui/icons-material'
Línea 6... Línea 6...
6
 
6
 
Línea 7... Línea 7...
7
import { useOutsideClick } from '@hooks'
7
import { useOutsideClick } from '@hooks'
8
 
8
 
9
import { axios } from '@app/utils'
9
import { axios } from '@app/utils'
Línea 10... Línea 10...
10
import { logout } from '@app/redux/auth/auth.actions'
10
import { asyncLogout } from '@app/redux/auth/auth.actions'
11
import { addNotification } from '@app/redux/notification/notification.actions'
11
import { addNotification } from '@app/redux/notification/notification.actions'
12
 
12
 
Línea 38... Línea 38...
38
    setDisplayOptions(false)
38
    setDisplayOptions(false)
39
  )
39
  )
Línea 40... Línea 40...
40
 
40
 
41
  const checkUserImage = () => {
41
  const checkUserImage = () => {
42
    const session_image = sessionStorage.getItem('user_session_image')
-
 
43
 
42
    const session_image = sessionStorage.getItem('user_session_image')
44
    if (!session_image) {
-
 
45
      return
-
 
46
    }
-
 
47
 
43
    if (!session_image) return
48
    setUserImage(session_image)
44
    setUserImage(session_image)
49
    sessionStorage.removeItem('user_session_image')
45
    sessionStorage.removeItem('user_session_image')
Línea 50... Línea 46...
50
  }
46
  }
Línea 62... Línea 58...
62
    } catch (error) {
58
    } catch (error) {
63
      console.log('>>: error > ', error)
59
      console.log('>>: error > ', error)
64
    }
60
    }
65
  }
61
  }
Línea 66... Línea 62...
66
 
62
 
67
  const handleLogout = (e) => {
63
  const handleLogout = async (e) => {
68
    e.preventDefault()
64
    e.preventDefault()
69
    axios
-
 
70
      .get('/signout')
-
 
71
      .then((response) => {
65
    try {
72
        const { success, data } = response.data
-
 
73
        if (!success) {
-
 
74
          throw new Error(data)
-
 
75
        }
-
 
76
 
66
      const response = await dispatch(asyncLogout())
77
        dispatch(addNotification({ style: 'success', msg: data.message }))
-
 
78
      })
-
 
79
      .then(() => dispatch(logout()))
67
      dispatch(addNotification({ style: 'success', msg: response.message }))
80
      .catch((error) => {
68
    } catch (error) {
81
        dispatch(addNotification({ style: 'danger', msg: error.message }))
69
      dispatch(addNotification({ style: 'danger', msg: error.message }))
82
      })
70
    }
Línea 83... Línea 71...
83
  }
71
  }
84
 
72
 
Línea 85... Línea 73...
85
  useEffect(() => {
73
  useEffect(() => {
86
    const timer = setInterval(() => checkUserImage(), 2000)
74
    const timer = setInterval(checkUserImage, 2000)
87
 
75
 
88
    return () => {
76
    return () => {