Focus auth username on page load.

This commit is contained in:
DebaucheryLibrarian 2024-03-18 02:03:31 +01:00
parent fe2576c24e
commit 0bd4990b37
2 changed files with 14 additions and 2 deletions

View File

@ -38,6 +38,7 @@
>{{ errorMsg }}</div>
<input
ref="userInput"
v-model="username"
placeholder="Username or e-mail"
class="input"
@ -81,7 +82,7 @@
</template>
<script setup>
import { ref, inject } from 'vue';
import { ref, onMounted, inject } from 'vue';
import { post } from '#/src/api.js';
import navigate from '#/src/navigate.js';
@ -94,6 +95,7 @@ const username = ref('');
const password = ref('');
const errorMsg = ref(null);
const userInput = ref(null);
const showPassword = ref(false);
async function login() {
@ -111,6 +113,10 @@ async function login() {
errorMsg.value = error.message;
}
}
onMounted(() => {
userInput.value.focus();
});
</script>
<style scoped>

View File

@ -39,6 +39,7 @@
>{{ errorMsg }}</div>
<input
ref="userInput"
v-model="username"
placeholder="Username"
class="input"
@ -122,7 +123,7 @@
</template>
<script setup>
import { ref, inject } from 'vue';
import { ref, onMounted, inject } from 'vue';
import { post } from '#/src/api.js';
import navigate from '#/src/navigate.js';
@ -136,6 +137,7 @@ const password = ref('');
const passwordConfirm = ref('');
const errorMsg = ref(null);
const userInput = ref(null);
const showPassword = ref(false);
async function signup() {
@ -159,6 +161,10 @@ async function signup() {
errorMsg.value = error.message;
}
}
onMounted(() => {
userInput.value.focus();
});
</script>
<style scoped>