Vulcan/packages/nova-core/lib/router.jsx

47 lines
1.3 KiB
React
Raw Normal View History

2016-02-23 13:10:08 +09:00
import Messages from "./messages.js";
2016-02-17 17:22:32 +09:00
FlowRouter.extendPathWithQueryParams = (path, params, newQueryParams) => {
const current = FlowRouter.current();
const currentQueryParams = _.clone(current.queryParams);
return FlowRouter.path(path, params, _.extend(currentQueryParams, newQueryParams));
};
FlowRouter.triggers.exit([() => Messages.clearSeen()]);
2016-02-23 13:10:08 +09:00
FlowRouter.addToQueryArray = function (key, value) {
var keyArray = FlowRouter.getQueryParam(key) || [];
keyArray.push(value);
var params = {};
params[key] = keyArray;
FlowRouter.setQueryParams(params);
}
FlowRouter.removeFromQueryArray = function (key, value) {
var keyArray = FlowRouter.getQueryParam(key);
keyArray = _.without(keyArray, value);
var params = {};
params[key] = keyArray;
FlowRouter.setQueryParams(params);
}
2016-02-17 14:39:56 +09:00
// FlowRouter.notFound = {
// action: function() {
// if (Meteor.isClient) {
// DocHead.addMeta({
// name: "name",
// property: "prerender-status-code",
// content: "404"
// });
// DocHead.addMeta({
// name: "name",
// property: "robots",
// content: "noindex, nofollow"
// });
// }
// BlazeLayout.render("layout", {main: "not_found"});
// }
// };
// FlowRouter.triggers.enter([function () {Events.analyticsRequest()}]);