From c5326e87958b1e99ca9405da5c8d17e3f45c983c Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Sun, 18 Jun 2023 15:12:41 +0200 Subject: [PATCH] Sign in: use v-model There's no need to mess with DOM elements, we can use the normal v-model approach for both username and password --- client/components/Windows/SignIn.vue | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/client/components/Windows/SignIn.vue b/client/components/Windows/SignIn.vue index 30963206..2145cf0e 100644 --- a/client/components/Windows/SignIn.vue +++ b/client/components/Windows/SignIn.vue @@ -19,14 +19,13 @@ @@ -36,9 +35,8 @@ (null); - const password = ref(null); + const username = ref(storage.get("user") || ""); + const password = ref(""); const onAuthFailed = () => { inFlight.value = false; @@ -89,8 +87,8 @@ export default defineComponent({ errorShown.value = false; const values = { - user: username.value?.value, - password: password.value?.value, + user: username.value, + password: password.value, }; storage.set("user", values.user); @@ -98,10 +96,6 @@ export default defineComponent({ socket.emit("auth:perform", values); }; - const getStoredUser = () => { - return storage.get("user"); - }; - onMounted(() => { socket.on("auth:failed", onAuthFailed); }); @@ -116,7 +110,6 @@ export default defineComponent({ username, password, onSubmit, - getStoredUser, }; }, });