26 lines
705 B
JavaScript
26 lines
705 B
JavaScript
import * as types from "./actionTypes";
|
|
import api from "./api";
|
|
import { sendHttpRequest } from "../../redux/actions/httpActions";
|
|
|
|
export function loadServerData() {
|
|
return async function(dispatch) {
|
|
try {
|
|
const data = await dispatch(sendHttpRequest(api.getServerData()));
|
|
dispatch({ type: types.LOAD_SERVER_DATA_SUCCESS, payload: data });
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
};
|
|
}
|
|
|
|
export function loadActiveSession() {
|
|
return async function(dispatch) {
|
|
try {
|
|
const data = await dispatch(sendHttpRequest(api.getActiveSession()));
|
|
dispatch({ type: types.LOAD_ACTIVE_SESSION_SUCCESS, payload: data });
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
};
|
|
}
|