How to use the connected-react-router/immutable.push function in connected-react-router

To help you get started, we’ve selected a few connected-react-router examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pietrzakadrian / bank / app / components / App / Header / saga.js View on Github external
const requestURL = `${env.API_URL}/api/users/logout/${token.id}`;

  try {
    const response = yield call(request, requestURL, {
      method: 'PUT',
      credentials: 'same-origin',
      headers: {
        Accept: 'application/json',
        'Content-Type': 'application/json',
        Authorization: `Bearer ${jwt}`,
        'CSRF-Token': readCookie('XSRF-TOKEN'),
      },
    });

    response.success
      ? (yield put(successLogoutAction()), yield put(push('/login')))
      : yield put(errorLogoutAction());
  } catch (err) {
    // yield put(errorLogoutAction());
  }
}
github jackdh / RasaTalk / app / containers / Expression / saga.js View on Github external
export function* updateIntentName({ agent }) {
  debug('updating Intent name');

  yield put(a.savingUpdatedIntentName(true));
  try {
    const intent = yield select(selectIntent());
    const originalIntent = yield select(selectOriginal());
    yield call(axios.patch, `/api/intents/${agent}/intent/${originalIntent}`, {
      intent,
    });
    yield put(a.setIntentName(intent));
    yield put(push(`/agents/${agent}/intent/${intent}`));
  } catch (error) {
    debug(error.message);
  } finally {
    yield put(a.savingUpdatedIntentName(false));
    // TODO Manually update the name change in the right places.
    // eslint-disable-next-line no-restricted-globals
    location.reload();
  }
}
github jackdh / RasaTalk / app / app.js View on Github external
// Do something with response error

    switch (error.response.status) {
      case 375:
        store.dispatch(
          showSnackbar(error.response.data, { variant: 'warning' }),
        );
        // setTimeout(() => {
        //   localStorage.removeItem('token');
        //   localStorage.removeItem('user');
        //   store.dispatch(push('/login'));
        // }, 1000);
        break;
      case 376:
        store.dispatch(showSnackbar(error.response.data, { variant: 'error' }));
        store.dispatch(push('/'));
        break;
      case 401:
        store.dispatch(showSnackbar(error.response.data, { variant: 'error' }));
        break;
      case 475:
        store.dispatch(showSnackbar(error.response.data)); // Updating to have prebuilt and then custom messages.
        break;
      default:
        break;
    }

    return Promise.reject(error);
  },
);
github gilmarsquinelato / i18n-manager / renderer / folder / __tests__ / sagas.ts View on Github external
it('openFolderAsync', () => {
    const data = [{ language: 'pt-BR', data: {} }];

    return expectSaga(openFolderAsync, { data })
      .put(actions.loadFolder(null))
      .put(push('/folder'))
      .put(actions.loadFolder(data))
      .run();
  });
github jackdh / RasaTalk / app / containers / Agents / saga.js View on Github external
export function* deleteAgent({ agent }) {
  debug('Deleting agent');

  yield put(a.deletingAgent(true));
  try {
    yield axios.delete(`/api/agents/${agent}`);
    yield put(push('/agents'));
    yield call(getAgents, { skip: true });
  } catch (error) {
    yield put(a.saveAgentFailure('Sorry something went wrong deleting that.'));
  } finally {
    yield put(a.deletingAgent(false));
  }
}
github jackdh / RasaTalk / app / containers / Entities / index.js View on Github external
                  cellClick: uid => dispatch(push(`/entities/${uid}`)),
                },
github jackdh / RasaTalk / app / containers / IntentPage / saga.js View on Github external
function* addIntent({ agent, intent, stay, resolve }) {
  debug('Adding Intent');
  yield put(a.addingIntent(true));

  try {
    yield call(axios.post, `/api/intents/${agent}`, { intent });

    yield put(a.addIntentSuccess(intent));
    if (stay) {
      yield put(reset('addIntent', 'intent'));
    } else {
      yield put(
        push(
          `/agents/${encodeURIComponent(agent)}/intent/${encodeURIComponent(
            intent,
          )}`,
        ),
      );
    }
  } catch (error) {
    yield put(
      a.addIntentFailure(
        "There was an error adding that intent. Perhaps It's a duplicate?",
      ),
    );
  } finally {
    yield put(a.addingIntent(false));
    resolve();
  }
github jackdh / RasaTalk / app / containers / Talk / index.js View on Github external
goTo: uid => {
      dispatch(push(`${ownProps.match.params.groupid}/${uid}`));
    },
    dispatch,
github gilmarsquinelato / i18n-manager / renderer / folder / sagas.ts View on Github external
export function* openFolderAsync({ data }: any) {
  yield put(actions.loadFolder(null));
  yield put(push('/folder'));
  yield put(actions.loadFolder(data));
}
github jackdh / RasaTalk / app / containers / IntentPage / index.js View on Github external
cellClick: route =>
                        dispatch(
                          push(
                            `/agents/${encodeURIComponent(
                              this.state.agent,
                            )}/intent/${encodeURIComponent(route)}`,
                          ),
                        ),
                    },