2017-08-09 46 views
1

不顯示用戶我使用useraccounts:導流useraccounts:兌現 & kadira:閃耀佈局。 FlowRouter將根據聲明導航到表單頁面,但仍顯示'/'路線。AccountsTemplates在FlowRouter/BlazeLayout

我已經在routes.js中聲明瞭AccountsTemplates配置,並試圖單獨聲明它無濟於事。

我應該如何構造這個不同,以使useraccounts:flow-routing顯示與流量路由器帳戶模板?

進口/啓動/客戶/ 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> 
+0

儘管文檔聲稱在路由前使用'configureRoute',我在樣板中找到'useraccounts:materialize',在正常路由之後配置路由。 ♂️,想嘗試一下,看看它是否有幫助? https://github.com/meteor-useraccounts/boilerplates/blob/master/materialize-flow-router/lib/router/routes.js –

回答

0

我覺得自己像個白癡。這其實很簡單。我還沒有實現一個{{#if currentUser}}和註銷過程。我做到了,並且發現如果你已經登錄,賬戶模板不會顯示。