-1

i have a form which i am using axios to submit a form in my laravel app like below :


<script>
export default {
  props: [ 'route' ],

  data: function () {
    return {
      mobile: ''
    }
  },

  methods: {
    submitMobile(){
      axios.post('/customer/send-sms', {
        mobile: this.mobile
      })
          .then(response => {
           console.log(response.data)

          })
          .catch(function (error) {
            console.log(error)
          });
    }
  },
}

</script>

now i know it may not possible but after submiting the form if the user mobile is valid and all other conditions that i check i want to redirect user to the page that enters the the verify code

Farshad
  • 1,830
  • 6
  • 38
  • 70
  • 2
    assuming that you have set up your vuejs routes. you can do `.then( () => { this.$router.push("/verify-code") })` – BillJustin Nov 09 '20 at 14:54

1 Answers1

2

If you are using Vue router, then in your axios then block, you could do something like:

.then(() => this.$router.push('/verify-path'))

If not, there are lots of different ways to achieve the same with vanilla javascript.

P. K. Tharindu
  • 2,565
  • 3
  • 17
  • 34