Пример #1
0
 return (dispatch, getState) => {
   localStorage.clear()
   dispatch(logOut())
   dispatch(routeActions.push('/login'))
 }
 .then((data) => {
   localStorage.setItem('phoenixAuthToken', data.jwt);
   setCurrentUser(dispatch, data.user);
   dispatch(routeActions.push('/'));
 })
Пример #3
0
 return dispatch => dispatch(routeActions.push('/dashboard/'))
Пример #4
0
 return dispatch => {
   dispatch({
     type: SIGNUP_SUCCESS
   })
   dispatch(routeActions.push('/me'))
 }
 imageClick: (photoId) => {
   dispatch(routeActions.push({
     pathname: C.ROUTES.PHOTO_DETAILS,
     search: '?photoId=' + photoId
   }))
 }
Пример #6
0
 dispatch(deis.getUsers()).then(({ error }) => {
   if (error) {
     this.props.dispatch(routeActions.push('/dash'))
   }
 })
Пример #7
0
 handleGoToInfo() {
   store.dispatch(routeActions.replace('/info'));
 }
 goBack: () => {
   dispatch(routeActions.goBack())
 }
Пример #9
0
 tagClick: () => {
   dispatch(routeActions.push({
     pathname: C.ROUTES.PHOTOS_BY_TAG,
     search: '?tag=' + ownProps.tag
   }))
 }
Пример #10
0
export const authenticationRouter = store => next => action => {
  if (action.err && action.status === 401)
    store.dispatch(routeActions.push('/login'))
  else next(action)
}
Пример #11
0
import {routeActions} from 'react-router-redux'

export default React.createClass({

  contextTypes: {
    router: React.PropTypes.object,
    store: React.PropTypes.object
  },

  handleSubmit(event) {
    event.preventDefault();
    const userName = event.target.elements[0].value;
    const repo = event.target.elements[1].value;
    const path = `/repos/${userName}/${repo}`;
    // this.context.router.push(path); // react-router approach
    this.context.store.dispatch(routeActions.push(path)); // react-router-redux approach
  },

  render() {
    return (
      <div>
        <h2>Repos</h2>
        <ul>
          <li><NavLink to="/repos/rackt/react-router">React Router</NavLink></li>
          <li><NavLink to="/repos/facebook/react">React</NavLink></li>
          <li>
            <form onSubmit={this.handleSubmit}>
              <input type="text" placeholder="userName"/> / {' '}
              <input type="text" placeholder="repo"/>{' '}
              <button type="submit">Go</button>
            </form>
Пример #12
0
 setTimeout(() => {
   dispatch(routeActions.push('/i/get-started'));
 }, 1000);
Пример #13
0
 handleDomainChange(nextDomain) {
     this.props.dispatch(routeActions.push('/domain/'+nextDomain))
 }
 handleLanguageChange(nextLanguage) {
     var selectedDomain = this.props.selectedDomain
     this.props.dispatch(selectLanguage(nextLanguage))
     this.props.dispatch(routeActions.push(`/domain/${selectedDomain}/lang/${nextLanguage}`))
 }
Пример #15
0
 navigate: route => dispatch(routeActions.push(route))
Пример #16
0
 return dispatch => {
   [
     loggedOut(),
     routeActions.push(AUTH_ROUTE)
   ].map(dispatch)
 }
Пример #17
0
function handleClick(e) {
  dispatch(routeActions.push('/'));
}
Пример #18
0
 changeRoute: (url) => dispatch(routeActions.push(url)),
Пример #19
0
 success: (d) => {
   dispatch(showSuccessNotification('Success!'))
   dispatch(deleteAuthorResult(id))
   dispatch(submittingChanged(false))
   dispatch(routeActions.push('/authors/'));
 },
Пример #20
0
		}, (err) => {
			dispatch(error(err));
			dispatch(routeActions.replace('/d2l/le/qed/error'));
		});
Пример #21
0
  return dispatch => {
    firebaseRef.unauth()
    dispatch(routeActions.push('/login'))

  }
Пример #22
0
	return (dispatch, getState) => {
		dispatch(routeActions.go(getState().app.returnUrl));
	};
Пример #23
0
	dispatch => ({
		onItemClicked (link) {
			dispatch(routeActions.push(link));
		}
	})
Пример #24
0
			() => dispatch(routeActions.go(getState().app.returnUrl))
Пример #25
0
/**
 * Forwards the user
 * @param {string} location The route the user should be forwarded to
 */
function forwardTo(location) {
  console.log(`forwardTo(${location}`);
  store.dispatch(routeActions.push(location));
}
 redirectToLogin() {
   // this would dispatch a notification then a route change.
   this.props.dispatch(routeActions.replace({ pathname: '/' }));
 }
 .catch(function(error) {
   console.log(error);
   dispatch(routeActions.push('/sign_in'));
 })
Пример #28
0
 return (dispatch) => {
   dispatch(routeActions.push(url))
 }
Пример #29
0
 <button onClick={() => dispatch(routeActions.push('/bar'))}>Go to bar page by history push</button>
Пример #30
0
 .catch(err => {
   localStorage.clear()
   dispatch(loginError(err))
   dispatch(routeActions.push('/login'))
 })