2020-05-12 02:31:25 +03:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2020-05-14 02:06:14 +03:00
|
|
|
|
|
|
|
export function loadSessionForwards(sessionId) {
|
|
|
|
return async function (dispatch) {
|
|
|
|
try {
|
|
|
|
dispatch({ type: types.LOAD_SESSION_FORWARDS_STARTED, id: sessionId });
|
|
|
|
const data = await dispatch(
|
|
|
|
sendHttpRequest(api.getSessionForwards(sessionId))
|
|
|
|
);
|
|
|
|
dispatch({
|
|
|
|
type: types.LOAD_SESSION_FORWARDS_SUCCESS,
|
|
|
|
payload: data,
|
|
|
|
id: sessionId
|
|
|
|
});
|
|
|
|
} catch (error) {
|
|
|
|
throw error;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|