How to use the react-router.Navigation 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 kinectus / connectus / client / js / components / outletsListMap.js View on Github external
}
        });
        console.log(that.state.userLocation);
      });
    } 
  },

  getInitialState: function(){
    return {
      outletData: [],
      outletTable: 'hello',
      userLocation: {}
    };
  },
  
  mixins: [Router.Navigation], //makes the router navigation information available for use (need this for redirection)
  
  componentDidMount: function() {
    this.getLocation();
    FooterCheck.checker();
    var that = this;
    // TODO: change function so that it retrieves only outlets near users location
    outletStore.getOutlets().then(function(outletData){
      outletData.map(function(outlet){
        userStore.getUsernameById(outlet.id).then(function(user){
          console.log(user.username)
          outlet['seller'] = user.username;
          that.setState({outletData: outletData});
        });
      });
    });
  },
github Gitualize / Gitualize / client / js / views / landing.react.jsx View on Github external
var $ = require('jquery');
var jqueryUI = require('jquery-ui');
var React = require('react/addons');
var Navigation = require('react-router').Navigation;
var ReactBootstrap = require('react-bootstrap');
var Input = ReactBootstrap.Input;
var Button = ReactBootstrap.Button;
var ButtonToolbar = ReactBootstrap.ButtonToolbar;
var ButtonInput = ReactBootstrap.ButtonInput;
var Grid = ReactBootstrap.Grid;
var Row = ReactBootstrap.Row;
var Col = ReactBootstrap.Col;
var Tooltip = ReactBootstrap.Tooltip;
var OverlayTrigger = ReactBootstrap.OverlayTrigger;

var Landing = React.createClass({
  mixins : [Navigation],
  errorMessages: {badRepo: "Unable to fetch the requested repository. You may only gitualize public repositories. Please try again in a little while if you believe this is a mistake, we're doing our best :)"},
  styles: {
    containerStyle: {
github yuroyoro / administa / js / components / list / SearchBox.react.js View on Github external
import Router          from 'react-router';
import ResourceActions from 'actions/ResourceActions';
import LinkMixin       from 'components/LinkMixin';

var PT = React.PropTypes

export default React.createClass({
  displayName: 'list/SearchBox',

  mixins: [LinkMixin, Router.Navigation],

  propTypes: {
    name: PT.string,
    pagination: PT.object,
    transition: PT.bool,
  },

  getInitialState: function() {
    return {value: this.props.pagination.q};
  },

  handleChange: function(event) {
    this.setState({value: event.target.value});
  },

  handleKeyPress: function(event) {
github rainyear / react-jwt-example / scripts / views / profile.js View on Github external
var React = require('react');
var Reflux = require('reflux');
var BS    = require('react-bootstrap');
var Router= require('react-router');
var actions = require('../actions/actions');

var userStore = require('../stores/userStore');

var Profile = React.createClass({
  mixins:[
    Router.Navigation,
    Reflux.listenTo(userStore, "updateProfile"),
  ],
  updateProfile: function(user){
    alert(user.balance)
  },
  getInitialState: function() {
    return {
      user: userStore.getDefaultUser(),
    };
  },
  componentDidMount: function() {
    if (!this.state.user.logd) {
      this.transitionTo("login");
    }
  },
  render: function(){
github konforti / people / components / web / client / pages / login / components / Logout.jsx View on Github external
var React = require('react/addons');
var ReactRouter = require('react-router');
var Actions = require('../Actions');
var LogoutStore = require('../stores/Logout');


var Link = ReactRouter.Link;
var Navigation = ReactRouter.Navigation;


var Component = React.createClass({
    mixins: [Navigation],
    getInitialState: function () {

        LogoutStore.reset();
        return LogoutStore.getState();
    },
    componentDidMount: function () {

        LogoutStore.addChangeListener(this.onStoreChange);
        Actions.logout();
    },
    componentWillUnmount: function () {
github walkdoer / Life-Time-Tracker / components / Project / ProjectTask.js View on Github external
});
                _needCalulate && (task.totalTime = totalTime);
            });
            return result;
        }).then(function (data) {
            that.setState({
                todayTaskTime: data
            });
        });
    }
});


var ProjectInfo = React.createClass({

    mixins: [PureRenderMixin, Router.State, Router.Navigation],

    propTypes: {
        onFilterTags: React.PropTypes.func
    },

    getDefaultProps: function () {
        return {
            onDateColumnClick: noop
        };
    },

    getInitialState: function () {
        return {
            showProjectDetail: false,
            selectTags: []
        };
github bioinformatics-ua / taska / workflowmanagement / ui / static / js / components / task.jsx View on Github external
render(){
        var row = this.props.rowData;
        return <span>{row.processtaskuser['user_repr']}</span>;
    }
});

const StatusShow = React.createClass({
    render(){
        return  <span disabled="">
                    {moment(this.props.data['date']).fromNow()}
                </span>
    }
});

export default React.createClass({
    mixins: [   Router.Navigation,
                Authentication,
                Reflux.listenTo(TaskStore, 'update'), Reflux.listenTo(ResultStore, 'update')],
    statics: {
        fetch(params, route) {
        if(route.name.toLowerCase().indexOf('result') !== -1){
            return new Promise(function (fulfill, reject){

                ResultActions.loadDetailIfNecessary.triggerPromise(params.object).then(
                    (result) =&gt; {

                        return TaskActions.loadDetailIfNecessary.triggerPromise(result.processtaskuser).then(
                            (task) =&gt; {
                                fulfill({
                                    result: result,
                                    task: task
                                });
github WRidder / react-spa / client / src / components / core / navLink2.jsx View on Github external
"use strict";
var React = require("react");
var Router = require("react-router");
var classSet = require("react/lib/cx");
var Navigation = Router.Navigation;
var State = Router.State;
var Link = Router.Link;

var NavigationLink = React.createClass({
  mixins: [State, Navigation],
  propTypes: {
    activeClassName: React.PropTypes.string.isRequired,
    to: React.PropTypes.string.isRequired
  },
  getDefaultProps: function () {
    return {
      activeClassName: "active"
    };
  },
  getClassName: function () {
    var classNames = {};
github walkdoer / Life-Time-Tracker / pages / Logs.js View on Github external
loadTotalTime: function () {
        var that = this;
        DataAPI.Log.totalTime()
            .then(function (total) {
                that.setState({
                    totalTime: total
                });
            });
    }
});


var LogsTable = React.createClass({

    mixins: [Router.Navigation],

    getInitialState: function () {
        return {
            sortDir: null,
            sortBy: null,
            logs: this.props.logs
        };
    },


    componentWillReceiveProps: function (nextProps) {
        this.setState({
            logs: nextProps.logs,
            sortBy: null,
            sortDir: null
        });