import * as types from "./actionTypes"; import api from "./api"; import { sendHttpRequest } from "../../redux/actions/httpActions"; export function loadServerSessions() { return async function (dispatch) { try { dispatch({ type: types.LOAD_SERVER_SESSIONS_STARTED }); const data = await dispatch(sendHttpRequest(api.getServerSessions())); dispatch({ type: types.LOAD_SERVER_SESSIONS_SUCCESS, payload: data }); } catch (error) { throw error; } }; }