Reputation: 2236
Quite basic setup - user submits a post, it's inserted by a method, then user should be routed to a confirm page with the _id
of the newly created post:
const onSubmitPost = (post) => {
createPost.call(post, (err, res) => {
if(err) {
instance.errorMessage.set(err.reason);
} else {
FlowRouter.go("create-post/:postId/confirm", { postId: res });
}
});
};
// Route definition
FlowRouter.route("/create-post/:postId/confirm", {
name: "create-confirm",
action() {
BlazeLayout.render("MainPage", { content: "ConfirmPostContainer" });
}
});
But when I try this, I get There is no route for the path: create-post/abc123/confirm
If I manually press reload, it works fine - no problems.
Anyone have any idea what's going on, and how to fix?
EDITS
/create-post
route - redirect to confirm the
post after it's createdredirect
instead of go
- no differenceUpvotes: 1
Views: 361
Reputation: 1807
There are 2 things I can suggest you to try. My hunch is that the problem stems from calling the .go
method from /create-post
with a relative path.
So, first, try route-names instead: FlowRouter.go('create-confirm', { postId: res });
Second, try absolute paths: FlowRouter.go('/create-post/' + res + '/confirm');
- notice the leading slash /
!
Does that work?
Upvotes: 1