Redirect from method in Vue.js with Vue-router

Posted 3 years ago by strategicsdemexico

Using vue.router, I have a component to create a post, how can I redirect from the method savePost of my component to other URL using the router?

savePost: function(){
            this.$http.post('/posts', this.post)
            .success(function(post){
                location.href = '/';
                /// Something like.... router.redirect('/')
            });
        },

Please sign in or create an account to participate in this conversation.