preliminary frontend for ther auth api
Some checks failed
Build and Deploy Frontend / build-and-deploy (push) Failing after 4s
Build and Deploy API / build-and-deploy (push) Successful in 12s

This commit is contained in:
2026-03-17 22:30:59 -05:00
parent c19cd0c718
commit 661bb03d1d
7 changed files with 54 additions and 21 deletions

View File

@@ -6,7 +6,7 @@
import { defineStore } from "pinia";
import type { User } from "../models/User.ts";
import * as api from "../api/UsersApi";
import * as usersApi from "../api/UsersApi";
interface UserState {
users: User[];
@@ -23,24 +23,24 @@ export const useUsersStore = defineStore("users", {
actions: {
async fetchUsers() {
this.loading = true;
const response = await api.getUsers();
const response = await usersApi.getUsers();
this.users = response.data;
this.loading = false;
},
async addUser(user: User) {
const response = await api.createUser(user);
const response = await usersApi.createUser(user);
this.users.push(response.data);
},
async updateUser(id: number, user: User) {
await api.updateUser(id, user);
await usersApi.updateUser(id, user);
const index = this.users.findIndex(i => i.id === id);
this.users[index] = user;
},
async removeUser(id: number) {
await api.deleteUser(id);
await usersApi.deleteUser(id);
this.users = this.users.filter(i => i.id !== id);
}
}