2

I am using useraccounts:flow-routing with useraccounts:materialize & kadira:blaze-layout. FlowRouter will navigate to the form page as declared, but still show the '/' route.

I've declared the AccountsTemplates configuration in routes.js and have tried declaring it separately to no avail.

How should I be structuring this differently to make useraccounts:flow-routing display the accounts templates with Flow Router?

imports/startup/client/routes.js

import { FlowRouter } from 'meteor/kadira:flow-router';
import { BlazeLayout } from 'meteor/kadira:blaze-layout';
import { AccountsTemplates } from 'meteor/useraccounts:core';


// Import needed templates
import '../../ui/layouts/body/body.js';
import '../../ui/pages/home/home.js';
import '../../ui/pages/not-found/not-found.js';
import '../../ui/pages/login/login_page.js';

// Account Templates
AccountsTemplates.configure({
    defaultLayout: 'App_body',
    defaultLayoutRegions: {},
    defaultContentRegion: 'main',
    enablePasswordChange: true,
    showForgotPasswordLink: true,
    sendVerificationEmail: true,
    confirmPassword: false,
});

AccountsTemplates.configureRoute('changePwd');
AccountsTemplates.configureRoute('forgotPwd');
AccountsTemplates.configureRoute('resetPwd');
AccountsTemplates.configureRoute('signIn', {
    path: '/login',
});
AccountsTemplates.configureRoute('signUp');
AccountsTemplates.configureRoute('verifyEmail');

// Set up all routes in the app
FlowRouter.route('/', {
    name: 'App.home',
    action () {
        BlazeLayout.render('App_body', { main: 'App_home' });
    },
});

FlowRouter.notFound = {
    action () {
        BlazeLayout.render('App_body', { main: 'App_notFound' });
    },
};

/imports/ui/layouts/body/body.html

<template name="App_body">
    <div class="wrapper">
        <nav>
            <div class="nav-wrapper">
              <a href="{{pathFor '/'}}" class="brand-logo">Pair of Losers</a>
              <a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
              <ul class="right hide-on-med-and-down">
                <li><a href="sass.html">Sass</a></li>
                <li><a href="badges.html">Components</a></li>
                <li><a href="collapsible.html">Javascript</a></li>
                <li><a href="mobile.html">Mobile</a></li>
            </ul>
            <ul class="side-nav" id="mobile-demo">
                <li><a href="{{pathFor '/login'}}">Login</a></li>
                <li><a href="{{pathFor '/sign-up'}}">Sign Up</a></li>
            </ul>
        </div>
    </nav>

    <div class="container">
        <div class="row">
            <div class="col-xs-12"> 
              {{> Template.dynamic template=main}}
          </div>
      </div>
  </div>
</div>
</template>
Chris
  • 644
  • 1
  • 12
  • 28
  • Even though the docs say to use `configureRoute` before your routes, I found on the boilerplate for `useraccounts:materialize` that they put `configureRoute` AFTER the normal routes. ‍♂️, want to try that and see if it helps? https://github.com/meteor-useraccounts/boilerplates/blob/master/materialize-flow-router/lib/router/routes.js – coagmano Aug 10 '17 at 00:44

1 Answers1

0

I feel like an idiot. It was actually very simple. I had not implemented a {{#if currentUser}} and logout process yet. I did that, and discovered the AccountsTemplates don't show if you are logged in.

Chris
  • 644
  • 1
  • 12
  • 28