Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 7367 Rev 7371
Línea 1... Línea 1...
1
import { axios } from '../../utils'
1
import { axios } from '../../utils'
2
import { actionsTypes } from './auth.types'
2
import { actionsTypes } from './auth.types'
Línea 3... Línea 3...
3
 
3
 
4
export const getPermissions = () => {
4
export const getPermissions = () => {
-
 
5
  return (dispatch) => {
5
  return (dispatch) => {
6
    dispatch(startLoading())
6
    axios
7
    axios
7
      .get('/signin', { headers: { 'Content-Type': 'application/json' } })
8
      .get('/signin', { headers: { 'Content-Type': 'application/json' } })
8
      .then(({ data: permissions }) => {
9
      .then(({ data: permissions }) => {
9
        dispatch(
10
        dispatch(
Línea 12... Línea 13...
12
      })
13
      })
13
      .catch((err) => {
14
      .catch((err) => {
14
        console.log(err)
15
        console.log(err)
15
        throw new Error(err)
16
        throw new Error(err)
16
      })
17
      })
-
 
18
      .finally(() => dispatch(stopLoading()))
17
  }
19
  }
18
}
20
}
Línea 19... Línea 21...
19
 
21
 
20
const setPermissions = (permissions) => ({
22
const setPermissions = (permissions) => ({
21
  type: actionsTypes.SET_PERMISSIONS,
23
  type: actionsTypes.SET_PERMISSIONS,
22
  payload: permissions,
24
  payload: permissions,
Línea -... Línea 25...
-
 
25
})
-
 
26
 
-
 
27
export const startLoading = () => ({
-
 
28
  type: actionsTypes.START_LOADING,
-
 
29
})
-
 
30
 
-
 
31
export const stopLoading = () => ({
-
 
32
  type: actionsTypes.LOGOUT,
23
})
33
})
24
 
34
 
25
export const login = () => ({
35
export const login = () => ({
Línea 26... Línea 36...
26
  type: actionsTypes.LOGIN,
36
  type: actionsTypes.LOGIN,