meteor-useraccounts / flow-routing

Useraccounts packages add-on for integration with Flow Router and Blaze Layout.
https://atmospherejs.com/useraccounts/flow-routing
MIT License
72 stars 50 forks source link

AccountsTemplates.configureRoute('signIn') fail - Bug in code #42

Open haunguyen90 opened 8 years ago

haunguyen90 commented 8 years ago

I'm using FlowRouter & react, and i'm encountering the issue with AccountsTemplates.configureRoute As your instruction

// routes.jsx

AccountsTemplates.configureRoute('signIn', {
  layoutType: 'blaze-to-react',
  name: 'signin',
  path: '/login',
  template: 'myLogin',
  layoutTemplate: CustomLayout,
  layoutRegions: {
    nav: <CustomNav />,
    footer: <CustomFooter />
  },
  contentRegion: 'main'
});

But i got error Match fail, then I check the code inside this package https://github.com/meteor-useraccounts/flow-routing/blob/master/lib/core.js - line 26 & 72

var ROUTE_PAT = {
  name: Match.Optional(String),
  path: Match.Optional(String),
  template: Match.Optional(String),
  layoutTemplate: Match.Optional(String),
  renderLayout: Match.Optional(Object),
  contentRange: Match.Optional(String),
  redirect: Match.Optional(Match.OneOf(String, Match.Where(_.isFunction))),
};
AccountsTemplates.configureRoute = function(route, options) {
  check(route, String);
  check(options, Match.OneOf(undefined, Match.ObjectIncluding(ROUTE_PAT)));
  options = _.clone(options);

The problem is check(options, Match.OneOf(undefined, Match.ObjectIncluding(ROUTE_PAT))); in ROUTE_PAT, there is a property layoutTemplate: Match.Optional(String) but i'm using react and as your instruction for AccountsTemplates.configureRoute is layoutTemplate: CustomLayout. That's why I got error Match fail. Please fix it

llvasconcellos commented 7 years ago

@haunguyen90 If you know where the problem is and how to fix it why don't you send a pull request?