Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6513 Rev 7331
Línea 4... Línea 4...
4
export const getPermissions = () => {
4
export const getPermissions = () => {
5
  return (dispatch) => {
5
  return (dispatch) => {
6
    axios
6
    axios
7
      .get('/signin', { headers: { 'Content-Type': 'application/json' } })
7
      .get('/signin', { headers: { 'Content-Type': 'application/json' } })
8
      .then(({ data: permissions }) => {
8
      .then(({ data: permissions }) => {
-
 
9
        if (permissions.is_logged_in) {
-
 
10
          dispatch(login())
-
 
11
        }
-
 
12
 
9
        dispatch(setPermissions(permissions))
13
        dispatch(setPermissions(permissions))
10
      })
14
      })
11
      .catch((err) => {
15
      .catch((err) => {
12
        console.log(err)
16
        console.log(err)
13
        throw new Error(err)
17
        throw new Error(err)
Línea 21... Línea 25...
21
})
25
})
Línea 22... Línea 26...
22
 
26
 
23
export const login = (permissions) => ({
27
export const login = (permissions) => ({
24
  type: actionsTypes.LOGIN,
28
  type: actionsTypes.LOGIN,
-
 
29
})
25
})
30
 
26
export const logout = (permissions) => ({
31
export const logout = (permissions) => ({
27
  type: actionsTypes.LOGOUT,
32
  type: actionsTypes.LOGOUT,