Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 72 Rev 93
Línea 1... Línea 1...
1
import { axios } from "../../utils";
1
import { axios } from "../../utils";
-
 
2
import { addNotification } from "../notification/notification.actions";
2
import { actionsTypes } from "./auth.types";
3
import { actionsTypes } from "./auth.types";
Línea 3... Línea 4...
3
 
4
 
4
export const validateAuth = () => {
5
export const validateAuth = () => {
5
  return (dispatch) => {
6
  return (dispatch) => {
Línea 6... Línea 7...
6
    dispatch(startLoading());
7
    dispatch(startLoading());
7
 
8
 
8
    axios
9
    axios
9
      .get("/signin", { headers: { "Content-Type": "application/json" } })
10
      .get("/signin", { headers: { "Content-Type": "application/json" } })
-
 
11
      .then((response) => {
-
 
12
        const { success, data, fatal } = response.data;
-
 
13
 
-
 
14
        if (fatal) {
-
 
15
          dispatch(startLogout());
Línea 10... Línea 16...
10
      .then((response) => {
16
          return;
-
 
17
        }
11
        const { success, data } = response.data;
18
 
12
 
19
        if (!success) {
Línea 13... Línea 20...
13
        if (!success) {
20
          dispatch(addNotification({ style: "danger", msg: data }));
14
          throw new Error(data);
21
          return;
15
        }
22
        }