mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Share the router configuration between the client and the server
This commit is contained in:
parent
592aa6d576
commit
6dc7404f23
2 changed files with 3 additions and 5 deletions
|
|
@ -113,7 +113,7 @@ const appTitle = 'Wekan';
|
||||||
// that the global variable `Boards` is undefined when this file loads so we
|
// 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
|
// 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.
|
// clean way once Meteor will support ES6 modules -- hopefully in Meteor 1.3.
|
||||||
Meteor.startup(() => {
|
Meteor.isClient && Meteor.startup(() => {
|
||||||
Tracker.autorun(() => {
|
Tracker.autorun(() => {
|
||||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||||
const titleStack = [appTitle];
|
const titleStack = [appTitle];
|
||||||
|
|
@ -51,10 +51,8 @@ if (isSandstorm && Meteor.isServer) {
|
||||||
// XXX Maybe the sandstorm http-bridge could provide some kind of "home URL"
|
// XXX Maybe the sandstorm http-bridge could provide some kind of "home URL"
|
||||||
// in the manifest?
|
// in the manifest?
|
||||||
const base = req.headers['x-sandstorm-base-path'];
|
const base = req.headers['x-sandstorm-base-path'];
|
||||||
// XXX If this routing scheme changes, this will break. We should generate
|
const { _id, slug } = sandstormBoard;
|
||||||
// the location URL using the router, but at the time of writing, the
|
const boardPath = FlowRouter.path('board', { id: _id, slug });
|
||||||
// it is only accessible on the client.
|
|
||||||
const boardPath = `/b/${sandstormBoard._id}/${sandstormBoard.slug}`;
|
|
||||||
|
|
||||||
res.writeHead(301, {
|
res.writeHead(301, {
|
||||||
Location: base + boardPath,
|
Location: base + boardPath,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue