Monaca Onsen UI Discord Chat Github Repo

How do I put pushPage in a if statement



  • Hi guys,
    So I want to make an if statement to see if a user is logged in. If they arent I want to push page a template IDd as “login.html” for some reason I can put it on a button but not in an if statement?
    I have tried:

    if (user == 1){
    document.querySelector('#navigator').bringPageTop('login.html', { animation: 'slide' });
    }
    

    Also

    const loadPage = (page) => {
          document.querySelector('#navigator').bringPageTop(page, { animation: 'slide' });
        };
    if(user === 1){
          loadPage('login.html');
        }
    

    and a few others