how to auto submit form after values of from are set after calling api
i want the form to auto submit after the values are successfully fetched from the api,
i used $refs.form.submit(), however, it doesn't work as expected,
a request is sent to: http://localhost:3200/login-saml (FE)
while expected url is : localhost:8080/login (BE)
<template>
<!-- Sing in Form -->
<section class="sign-in" style="padding-top: 65px">
<div class="container">
<form v-bind:action="urlLogin" method="post" ref="form">
<input type="text" id="SAMLRequest" name="SAMLRequest" v-model="SAMLRequest">
<input type="submit" value="Submit">
</form>
</div>
</section>
</template>
<script>
import axios from 'axios';
export default {
name: 'LoginPage',
data() {
return {
urlLogin: '',
SAMLRequest: ''
}
},
mounted() {
axios.get(`http://localhost:8080/rest/v2/sso/loginInfo`)
.then(response => {
this.urlLogin = response.data.urlLogin;
this.SAMLRequest = response.data.samlrequest;
this.$refs.form.submit();
})
.catch(e => {
console.log(e)
})
}
}
</script>