It looks like the code is trying to redirect to different pages based on which submit button was clicked, but the redirection is not working. One possible reason for this could be that this is not referring to the Vue instance inside the then callback function. To fix this, you can store a reference to this in a variable before making the HTTP request, and then use that variable inside the callback function. Here's an example:
// store a reference to `this` in a variable
var vm = this;
self.$http
.post(self.$member_whitelist_signup, form_data)
.then(function (response) {
if (response.data.success == true) {
if (vm.saveClicked) { // use `vm` instead of `this`
vm.$router.replace({ path: '/member/member-questionnaire' });
} else {
vm.$router.replace('/questionnaire');
}
} else {
// handle error
}
});
Also, make sure that the saveClicked property is set correctly based on which submit button was clicked. You can use a v-model directive to bind the value of the submit button to a data property in Vue. Here's an example:
<template>
<div>
<form @submit.prevent="submitForm">
<!-- form fields -->
<button type="submit" v-model="saveClicked" value="true">Save and Continue</button>
<button type="submit" v-model="saveClicked" value="false">Continue Without Saving</button>
</form>
</div>
</template>
<script>
export default {
data() {
return {
saveClicked: null
};
},
methods: {
submitForm() {
// make HTTP request and handle response
}
}
};
</script>