Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3036 Rev 3395
Línea 15... Línea 15...
15
 
15
 
16
export default function App() {
16
export default function App() {
17
  const [loading, setLoading] = useState(true)
17
  const [loading, setLoading] = useState(true)
18
  const [credentialsError, setCredentialsError] = useState(false)
18
  const [credentialsError, setCredentialsError] = useState(false)
19
  const { data: labels } = useFetch('/language')
19
  const { data: labels } = useFetch('/language')
20
  const { isAuth } = useSelector(({ auth }) => auth)
20
  const { isAuth, aes } = useSelector(({ auth }) => auth)
Línea 21... Línea 21...
21
  const dispatch = useDispatch()
21
  const dispatch = useDispatch()
22
 
22
 
23
  const getCredentials = async () => {
23
  const getCredentials = async () => {
Línea 29... Línea 29...
29
 
29
 
30
  const getUserCredentials = async () => {
30
  const getUserCredentials = async () => {
31
    setLoading(true)
31
    setLoading(true)
32
    getCredentials()
32
    getCredentials()
33
      .then((credentials) => {
-
 
34
        const localAes = window.localStorage.getItem('aes')
-
 
35
        const localJwt = window.localStorage.getItem('jwt')
33
      .then((credentials) => {
36
        const permissions = structuredClone(credentials)
34
        const permissions = structuredClone(credentials)
-
 
35
        permissions.isAuth = credentials.is_logged_in
Línea 37... Línea -...
37
        permissions.isAuth = credentials.is_logged_in
-
 
38
 
-
 
39
        if (localAes) {
-
 
40
          permissions.aes = localAes
-
 
41
        } else {
-
 
42
          permissions.aes = credentials.aes
-
 
43
          window.localStorage.setItem('aes', credentials.aes)
-
 
44
        }
-
 
45
 
-
 
46
        if (localJwt) {
-
 
47
          permissions.jwt = localJwt
-
 
48
        } else {
36
        permissions.aes = credentials.aes ? credentials.aes : aes
49
          permissions.jwt = credentials.jwt
-
 
50
          window.localStorage.setItem('jwt', credentials.jwt)
-
 
51
        }
37
 
52
 
38
        window.localStorage.setItem('jwt', credentials.jwt)
53
        dispatch(setPermissions(permissions))
39
        dispatch(setPermissions(permissions))
54
      })
40
      })
55
      .catch((error) => {
41
      .catch((error) => {