How to use the fluxible-router.navigateAction function in fluxible-router

To help you get started, we’ve selected a few fluxible-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 yahoo / fluxible / examples / chat / server.js View on Github external
server.use(function (req, res, next) {
    var context = app.createContext({
        req: req, // The fetchr plugin depends on this
        xhrContext: {
            _csrf: req.csrfToken() // Make sure all XHR requests have the CSRF token
        }
    });

    debug('Executing showChat action');
    if ('0' === req.query.load) {
        renderPage(req, res, context);
    } else {
        context.executeAction(navigateAction, { url: req.url, type: 'pageload' }, function (err) {
            if (err) {
                if (err.statusCode && err.statusCode === 404) {
                    next();
                } else {
                    next(err);
                }
                return;
            }
            renderPage(req, res, context);
        });
    }
});
github dockunit / platform / actions / deleteProject.js View on Github external
context.service.delete('projects', payload, {}, function(error, response) {
		if (error) {
			context.dispatch('DELETE_PROJECT_FAILURE', payload);
			done();
			return;
		}

		context.dispatch('DELETE_PROJECT_SUCCESS', response.repository);

		if ('undefined' !== typeof window && 'undefined' !== typeof io) {
			var socket = io();
			socket.emit('leave', { repository: payload.project.repository } );
		}

		navigateAction(context, {
	        url: '/projects'
	    }, done);
	});
};
github localnerve / flux-react-example / server / main.js View on Github external
.then(function () {
      debug('Executing navigate action');
      return context.executeAction(navigateAction, {
        url: req.url
      });
    })
    .then(null, function (reason) {
github localnerve / flux-react-example / components / Application.jsx View on Github external
handleSwipe: function (index) {
    var pages = this.props.pages;
    if (pages[this.props.pageName].order !== index) {
      var nextPageName = Object.keys(pages).filter(function (page) {
        return pages[page].order === index && pages[page].mainNav;
      })[0];

      this.context.executeAction(navigateAction, {
        name: nextPageName,
        url: pages[nextPageName].path
      });
    }
  },
github dockunit / platform / actions / createProject.js View on Github external
context.service.create('projects', payload, {}, function(error, response) {
		if (error) {
			context.dispatch('CREATE_PROJECT_FAILURE', payload);
			done();
			return;
		}

		context.dispatch('CREATE_PROJECT_SUCCESS', response.project);

		navigate(context, {
	        url: '/projects/' + payload.repository
	    }, function() {
	    	context.service.create('builds', payload, {}, function() {
				done();
			});
	    });
	});
};
github dockunit / platform / server.js View on Github external
if ('header' === req.session.loginType) {
			context.executeAction(updateLoginHeaderStatus, req.session.errorNum);
		} else {
			req.url = '/login';
			context.executeAction(updateLoginFormStatus, req.session.errorNum);
		}

		req.session.errorNum = 0;
	}

    debug('Setting Csrf token to ' + req.csrfToken());
	context.executeAction(updateCsrfToken, req.csrfToken());

	debug('Executing navigate action');
    context.executeAction(navigateAction, {
        url: req.url,
		method: req.method
    }, function (err) {
        if (err) {
            if (err.status && err.status === 404) {
                next();
            } else {
                next(err);
            }
            return;
        }

        if (req.url.match(/^\/blog\/.+$/i)) {
        	context.executeAction(readPost, req.url.replace(/^\/blog\/(.+)\/?$/i, '$1'), function() {
        		debug('Exposing context state');
		        var exposed = 'window.App=' + serialize(app.dehydrate(context)) + ';';