Update
This commit is contained in:
@@ -40,38 +40,35 @@
|
||||
|
||||
{% block script %}
|
||||
<script type="text/javascript">
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
username: '',
|
||||
password: '',
|
||||
error: null
|
||||
},
|
||||
methods: {
|
||||
login: function() {
|
||||
let vm = this;
|
||||
axios.post(
|
||||
'/api',
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "login",
|
||||
"params": {
|
||||
"username": vm.username,
|
||||
"password": vm.password
|
||||
},
|
||||
"id": 1
|
||||
Object.assign(root.data, {
|
||||
username: '',
|
||||
password: '',
|
||||
error: null
|
||||
});
|
||||
Object.assign(root.methods, {
|
||||
login: function() {
|
||||
let vm = this;
|
||||
axios.post(
|
||||
'/api',
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "login",
|
||||
"params": {
|
||||
"username": vm.username,
|
||||
"password": vm.password
|
||||
},
|
||||
"id": 1
|
||||
}
|
||||
).then(
|
||||
function(response) {
|
||||
if ('result' in response.data) {
|
||||
window.location.href = '/';
|
||||
} else if ('error' in response.data) {
|
||||
vm.error = response.data['error'].message;
|
||||
}
|
||||
).then(
|
||||
function(response) {
|
||||
if ('result' in response.data) {
|
||||
window.location.href = '/';
|
||||
} else if ('error' in response.data) {
|
||||
vm.error = response.data['error'].message;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user