<template>
<form>
<p v-if='errorMessage'>{{ errorMessage }}</p>
<input type='text' v-model='username'/>
<input type='password' v-model='password'/>
<button @click='send()'>Log in</button>
</form>
</template>
<script>
import someHttpClient from 'someHttpClient'
export default {
data: {
return {
username: '',
password: '',
errorMessage: ''
}
},
methods: {
send () {
var username, password, errorMessage = this
if (username && password) {
errorMessage = ''
someHttpClient.sendAndMaybeCipher({ username, password })
} else {
errorMessage = 'Form not filled properly'
}
}
}
}
</script>
Примеры запроса: