error and busy are reactive
This commit is contained in:
@@ -26,19 +26,20 @@ const BASE_URL = import.meta.env.VITE_API_ORIGIN ? 'https://' + import.meta.env.
|
||||
let username = ref('');
|
||||
let password = ref('');
|
||||
let totpToken = ref('');
|
||||
let error = ref(false);
|
||||
let error = ref('');
|
||||
let busy = ref(false);
|
||||
|
||||
// exposed to dom elements normally as in angulare with $scope.onLogin
|
||||
async function onLogin() {
|
||||
error = false;
|
||||
error.value = false;
|
||||
|
||||
busy.value = true;
|
||||
|
||||
busy = true;
|
||||
const [err, res] = await safe(superagent.post(`${BASE_URL}/api/v1/cloudron/login`).send({ username: username.value, password: password.value, totpToken: totpToken.value }));
|
||||
busy = false;
|
||||
busy.value = false;
|
||||
|
||||
if (err && err.status === 401) {
|
||||
error = 'Invalid username or password';
|
||||
error.value = 'Invalid username or password';
|
||||
password.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user