From ae1936a5f6b2f5aa467208b6cdfbec67c2f9bed0 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Sun, 19 Feb 2023 17:16:33 +0100 Subject: [PATCH] error and busy are reactive --- src/components/Login.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/Login.vue b/src/components/Login.vue index 2ffd6c452..106f8a145 100644 --- a/src/components/Login.vue +++ b/src/components/Login.vue @@ -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; }