summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2015-12-28 22:59:39 +0100
committerMaxime Quandalle <maxime@quandalle.com>2015-12-28 23:13:20 +0100
commit6dc7404f23796784c212e6db1b4fca22c7a1ac82 (patch)
tree1a9dc8df304eb76359b5f049e58e436b75fa43fc
parent592aa6d5762b6d04e4f66364da4a58cea6b25d67 (diff)
downloadwekan-6dc7404f23796784c212e6db1b4fca22c7a1ac82.tar.gz
wekan-6dc7404f23796784c212e6db1b4fca22c7a1ac82.tar.bz2
wekan-6dc7404f23796784c212e6db1b4fca22c7a1ac82.zip
Share the router configuration between the client and the server
-rw-r--r--config/router.js (renamed from client/config/router.js)2
-rw-r--r--sandstorm.js6
2 files changed, 3 insertions, 5 deletions
diff --git a/client/config/router.js b/config/router.js
index ddd69db4..99d5bff6 100644
--- a/client/config/router.js
+++ b/config/router.js
@@ -113,7 +113,7 @@ const appTitle = 'Wekan';
// that the global variable `Boards` is undefined when this file loads so we
// wait a bit until hopefully all files are loaded. This will be fixed in a
// clean way once Meteor will support ES6 modules -- hopefully in Meteor 1.3.
-Meteor.startup(() => {
+Meteor.isClient && Meteor.startup(() => {
Tracker.autorun(() => {
const currentBoard = Boards.findOne(Session.get('currentBoard'));
const titleStack = [appTitle];
diff --git a/sandstorm.js b/sandstorm.js
index 11bafa10..def07eea 100644
--- a/sandstorm.js
+++ b/sandstorm.js
@@ -51,10 +51,8 @@ if (isSandstorm && Meteor.isServer) {
// XXX Maybe the sandstorm http-bridge could provide some kind of "home URL"
// in the manifest?
const base = req.headers['x-sandstorm-base-path'];
- // XXX If this routing scheme changes, this will break. We should generate
- // the location URL using the router, but at the time of writing, the
- // it is only accessible on the client.
- const boardPath = `/b/${sandstormBoard._id}/${sandstormBoard.slug}`;
+ const { _id, slug } = sandstormBoard;
+ const boardPath = FlowRouter.path('board', { id: _id, slug });
res.writeHead(301, {
Location: base + boardPath,