Asyn is not working in index path?

Hi,

I am trying to check user loggedin condition on index path but async is not working here, Please suggest how to fix this issues.

routes = [
      {
        path: '/',
        async(routeTo, routeFrom, resolve, reject) {
          if (userIsLoggedIn) {
            resolve({ url: 'secured.html' })
          } else {
            resolve({ url: 'login.html' })
          }
        }
      }
    ]

It is working for home page as for any other page. Check the console, the could be some error, or your home page route doesn’t match to /

Thanks for your reply, i have checked my console but no error.

Code in my index.html is

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, viewport-fit=cover">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
  <meta name="theme-color" content="#2196f3">
  <meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap:">
  <title>Framework7</title>
  <link rel="stylesheet" href="dist/css/framework7.min.css">
  <link rel="stylesheet" href="css/app.css">  
  <link rel="icon" href="img/f7-icon.png">
</head>
<body>
  <div id="app">    
    <div class="view view-main ios-edges" data-url="/">
      <div class="page">
		<div class="page-content">
          <div class="block-title">Index Page</div>
          <div class="block">
            <p>Am in Home page</p>
          </div>          
        </div>
      </div>
    </div>
  </div>
  <script src="dist/js/framework7.min.js"></script>
  <script src="js/routes.js"></script>
  <script src="js/app.js"></script>
</body>
</html>

code in my routes.js is

var routes = [
	// Index page
	{
		path: '/',		
		name: 'home',		
		async(routeTo, routeFrom, resolve, reject) {
			console.log(userloggedin);
			if (userloggedin) {
				resolve({url: './pages/about.html'})
			} else {
				resolve({url: './pages/404.html'})
			}
		},		
	},
	// About page
	{
		path: '/about/',
		url: './pages/about.html',
		name: 'about',
	},
	// Default route (404 page). MUST BE THE LAST
	{
		path: '(.*)',
		url: './pages/404.html',
	},
];

Code in my app.js

// Dom7
var $ = Dom7;

var userloggedin = 1;
// Init App
var app = new Framework7({
  id: 'io.framework7.testapp',
  root: '#app',
  theme: 'md',
  data: function () {
    return {
      user: {
        firstName: 'John',
        lastName: 'Doe',
      },
    };
  },
  methods: {
    helloWorld: function () {
      app.dialog.alert('Hello World!');
    },
  },
  routes: routes,
  vi: {
    placementId: 'pltd4o7ibb9rc653x14',
  },
});


app.views.create('.view-main', {
  url: '/'
});

I have tried as mush as possible but no improvement, Please give some suggestion to fix this issue. Please find attachment for no console error.

http://framework7.io/docs/view.html#initial-page-route

I have got the same issue. Did/How you solve it?

please, elaborate. no console, nothing works in routes.js file in latest framework7 v5.4.5