don't load forwards if the array already exists in state

master
Tudor Stanciu 2020-05-14 14:37:39 +03:00
parent c5e2a03a93
commit 3a7613e9ff
1 changed files with 4 additions and 1 deletions

View File

@ -15,8 +15,11 @@ export function loadServerSessions() {
}
export function loadSessionForwards(sessionId) {
return async function (dispatch) {
return async function (dispatch, getState) {
try {
const forwards = getState().forwards[sessionId];
if (forwards && (forwards.loading || forwards.loaded)) return;
dispatch({ type: types.LOAD_SESSION_FORWARDS_STARTED, id: sessionId });
const data = await dispatch(
sendHttpRequest(api.getSessionForwards(sessionId))