literally every time
All checks were successful
Build and Deploy Frontend / build-and-deploy (push) Successful in 6s
All checks were successful
Build and Deploy Frontend / build-and-deploy (push) Successful in 6s
This commit is contained in:
47
client/src/pages/LoginForm.vue
Normal file
47
client/src/pages/LoginForm.vue
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
import { onMounted, reactive } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
import * as authApi from "../api/AuthApi";
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const user = reactive({
|
||||
username: "",
|
||||
password: ""
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
});
|
||||
|
||||
async function login(): Promise<void> {
|
||||
|
||||
const success: boolean = await authApi.login(user);
|
||||
|
||||
if(success) {
|
||||
router.push("/users"); // redirect
|
||||
} else {
|
||||
// prompt try again
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<div>
|
||||
<h2>Login</h2>
|
||||
|
||||
<form @submit.prevent="login">
|
||||
<input v-model="user.username" placeholder="username" />
|
||||
<input v-model="user.password" type="password" placeholder="password" />
|
||||
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
Reference in New Issue
Block a user