user3626441
user3626441

Reputation:

Framework7 - Unable to redirect to a different view

I am really lost with Framework 7, I find it quite difficult to work with as I cannot find the information I am looking for in the doc(in an easy way).

I only want to redirect the user to a different view which is here 
pages/login.html after my ajax call as:

500: function (response) { //error
      app.dialog.close();
      console.log("error 500");
     //This does not work
      resolve({
        componentUrl: './pages/login.html',
      })

I tried this but it does not work:
path: ‘/login/’,
url: ‘./pages/login.html’,

Have anyone a bit of experience with this framework please?

https://framework7.io/vue/navigation-router.html

Thank you,

Upvotes: 0

Views: 2551

Answers (2)

ArefinDe
ArefinDe

Reputation: 678

You can use this methods: return app.router.navigate('/yourbooking/'); or return app.views.main.router.navigate('/');

Here navigate methods first argument is the path you give in route.js file.

example:

{
    path:'/yourbooking/',
    componentUrl:'./pages/yourbooking.html',

},

for your case it should be like this:

app.request.post('../authenticate.php/', {
            userdata: userdata,
        }, function (success) {

            console.log(success);

            return app.views.main.router.navigate('/login/');
        },
        function (error) {
            console.log("error");

        });

Upvotes: 2

user3626441
user3626441

Reputation:

I found the answer:

app.router.navigate('/login/');

Upvotes: 0

Related Questions