Open trsh opened 8 years ago
Try this after adding packages as described in docs.
I put the below code blocks in my router.js file that is imported by imports/startup/client/index.js as described in guide.meteor.com application structure.
import { FlowRouter } from 'meteor/kadira:flow-router';
import { BlazeLayout } from 'meteor/kadira:blaze-layout';
import { Accounts } from 'meteor/useraccounts:semantic-ui';
import { AccountsTemplates } from 'meteor/useraccounts:core';
//your other template imports
import '../../ui/pages/admin/signin.js';
var public = FlowRouter.group({
//public route triggers, etc
})
var private = FlowRouter.group({
triggersEnter: [AccountsTemplates.ensureSignedIn]
})
private.route('/admin', {
action: function(params, queryParams) {
BlazeLayout.render('MasterTemplate', { main: "Admin" });
},
name: 'Admin'
})
public.route('/sign-in', {
action: function(params, queryParams) {
BlazeLayout.render('MasterTemplate', { main: "SignIn" });
},
name: 'SignIn'
});
//more routes...
AccountsTemplates.configure({
defaultLayoutType: 'blaze',
defaultLayout: 'MasterLayout',
//defaultTemplate: 'myCustomFullPageAtForm',
defaultLayoutRegions: {},
defaultContentRegion: 'main'
});
AccountsTemplates.configureRoute('signIn', {
name: 'signin',
path: '/sign-in',
redirect: '/'
});
//end of router.js
Then in the signin template..
<template name="SignIn">
{{> fullPageAtForm}}
</template>
and in the signin.js
import { Template } from 'meteor/templating';
import './signin.html';
That should get you started. The trick is that this module 'extends' the useraccounts:core package, so by importing it, you also get the flow-router extensions (if you've added this package). I use Semantic UI for Blaze stuff, so I've included that in this example but I'm 99.9% sure any of the accounts-ui templating add ons will work the same.
This thing is like month old. I don't even remember why writing it :/
Hmm not sure why you wrote it but I spent 2-3 hours working out how to get flow-router account-ui integration working properly using imports. So there it is for anyone who wants to find it.
With newest builds AccountsTemplates.ensureSignedIn is undefined.