fix client to api dtos again
This commit is contained in:
@@ -21,7 +21,7 @@ onMounted(() => { // register callback for when component is loaded on page
|
||||
|
||||
<table>
|
||||
<tr v-for="user in store.users" :key="user.id">
|
||||
<td>{{ user.name }}</td>
|
||||
<td>{{ user.username }}</td>
|
||||
<td>
|
||||
<router-link :to="`/user/${user.id}`">Edit</router-link>
|
||||
<button @click="store.removeUser(user.id)">Delete</button>
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
|
||||
export interface User {
|
||||
id: number;
|
||||
name: string;
|
||||
username: string;
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface RegisterDto {
|
||||
name: string;
|
||||
username: string;
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface LoginDto {
|
||||
name: string;
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import * as authApi from "../api/AuthApi";
|
||||
const router = useRouter();
|
||||
|
||||
const user = reactive<LoginDto>({ // the template ensures type consistency
|
||||
name: "",
|
||||
username: "",
|
||||
password: "",
|
||||
});
|
||||
|
||||
@@ -38,7 +38,7 @@ async function login(): Promise<void> {
|
||||
<h2>Login</h2>
|
||||
|
||||
<form @submit.prevent="login">
|
||||
<input v-model="user.name" placeholder="username" />
|
||||
<input v-model="user.username" placeholder="username" />
|
||||
<input v-model="user.password" type="password" placeholder="password" />
|
||||
|
||||
<button type="submit">Submit</button>
|
||||
|
||||
@@ -10,7 +10,7 @@ import * as authApi from "../api/AuthApi";
|
||||
const router = useRouter();
|
||||
|
||||
const user = reactive<RegisterDto>({ // the template ensures type consistency
|
||||
name: "",
|
||||
username: "",
|
||||
email: "",
|
||||
password: "",
|
||||
});
|
||||
@@ -40,7 +40,7 @@ async function register(): Promise<void> {
|
||||
<h2>Register</h2>
|
||||
|
||||
<form @submit.prevent="register">
|
||||
<input v-model="user.name" placeholder="username" />
|
||||
<input v-model="user.username" placeholder="username" />
|
||||
<input v-model="user.email" placeholder="email" />
|
||||
<input v-model="user.password" placeholder="password" />
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ const router = useRouter();
|
||||
|
||||
const user = ref<User>({
|
||||
id: 0,
|
||||
name: "",
|
||||
username: "",
|
||||
email: "",
|
||||
password: ""
|
||||
});
|
||||
@@ -46,7 +46,7 @@ async function save(): Promise<void> {
|
||||
<h2>{{ id ? "Edit User" : "Create User" }}</h2> <!-- omg I love ternary operator :D -->
|
||||
|
||||
<form @submit.prevent="save">
|
||||
<input v-model="user.name" placeholder="Name" />
|
||||
<input v-model="user.username" placeholder="Name" />
|
||||
|
||||
<button type="submit">Save</button>
|
||||
</form>
|
||||
|
||||
@@ -28,7 +28,7 @@ function logout() {
|
||||
|
||||
<table>
|
||||
<tr v-for="user in store.users" :key="user.id">
|
||||
<td>{{ user.name }}</td>
|
||||
<td>{{ user.username }}</td>
|
||||
<td>
|
||||
|
||||
<router-link :to="`/user/${user.id}`" custom v-slot="{ navigate }">
|
||||
|
||||
Reference in New Issue
Block a user