Iron route with login template

i’m making a app where you have to login to use it.

The problem is:

      layoutTemplate: 'mainLayout'

How to disable it so I only use the welcome template with the login form

The code below almost work, but it shows the welcome template and the mainLayout template

Router.onBeforeAction(function () {
  // all properties available in the route function
  // are also available here such as this.params

  if (!Meteor.userId()) {
    // if the user is not logged in, render the Login template
  } else {
    // otherwise don't hold up the rest of hooks or our route/action function
    // from running;

Sorry this isn’t an answer to your question.

I don’t know how much help you will find in the forums for using Iron Router.
That was the favourite a while ago - you’re best to swap out to using Flow Router.

This is what I do :slight_smile:

  layoutTemplate: function(){
    return Meteor.userId() ? 'layout' : 'empty';
<template name="empty">{{>yield}}</template>

It works perfect, thanks