How to use the react-router.browserHistory.push function in react-router

To help you get started, we’ve selected a few 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 Playing-Indoors / KDM_WWW / src / scenes / Survivor / containers / DeathRecord.jsx View on Github external
handleClose() {
    browserHistory.push(
      `/settlements/${this.props.params.oid}/survivors/${this.props.params
        .survivorId}`
    );
  }
  // Handle's the save and makes the API Call
github inkdrop-network / inkdrop-app / src / user / userSagas.js View on Github external
// update store
      yield put({
        type: USER_LOGGED_IN,
        payload: newUser,
      })
      // change route to newsfeed (or to redirect url)
      let currentLocation = browserHistory.getCurrentLocation()

      if ('redirect' in currentLocation.query) {
        yield browserHistory.push(decodeURIComponent(currentLocation.query.redirect))
      } else {
        yield browserHistory.push('/newsfeed')
      }
    } catch (error) {}
  } else {
    yield browserHistory.push('/signup')
  }
}
github november9 / wecansavedemocracy / src / containers / ActivitiesNew / individual_activity.js View on Github external
addActivity(activityData) {
    if (activityData.acf.special_content !== 'findrep' && activityData.acf.special_content !== 'elections') {
      this.props.addUserActivity(activityData);
      browserHistory.push('/');
    } else {

      switch (activityData.acf.special_content) {
        case 'findrep':
          this.props.lookForReps(activityData);
          browserHistory.push('/find-representative');
          break;
        case 'elections':
          // do something
          break;
        default:
        // do something by default
      }
    }
  }
github numenta / numenta-web / packages / numenta.com / pages / press / releases.jsx View on Github external
_yearChanged(event) {
    // Reset postion to first page when changing the year
    const year = parseInt(event.target.value, 0)
    const state = Object.assign({}, this.state, {position: 0, year})
    this.setState(state)

    // Update history to include the new state
    const {location} = this.props
    const {key, pathname, query, hash} = location
    browserHistory.push({
      key, pathname, query, hash, state,
    })
  }
github ericclemmons / graphql-demo / src / components / PostCreator.js View on Github external
.then((response) => {
        if (response.errors) {
          throw new Error(response.errors[0].message);
        }

        const { slug } = response.data.createPost;

        browserHistory.push(`/posts/${slug}`);
      })
      .catch((error) => this.setState({ error }))
github bonham000 / react-quiz-app / src / client / actions / logout.js View on Github external
return dispatch => {
    dispatch(requestLogout())
    localStorage.removeItem('id_token')
    localStorage.removeItem('user')
    dispatch(receiveLogout())
    browserHistory.push('/logout')
  }
}
github nuitcoder / neubbs / src / main / webapp / app / sagas / account.js View on Github external
export function* logoutSaga(action) {
  const { data } = yield call(auth.logout)

  try {
    if (data.success) {
      yield put({ type: types.LOGOUT_SUCCESS })
      browserHistory.push(routes.ACCOUNT_LOGIN)
    } else {
      yield call(handleError, action, data)
    }
  } catch (err) {
    yield call(handleError, action, err)
  }
}
github jasobs10 / OnTap / frontend / components / shared / navbar.jsx View on Github external
          <li> browserHistory.push('/breweries')}&gt;
            Breweries</li>
github harryttd / Online-Bling / app / components / Navbar.jsx View on Github external
             browserHistory.push("/about")}&gt;ABOUT
             browserHistory.push("/press")}&gt;PRESS