checkpoint
All checks were successful
Build and Deploy Frontend / build-and-deploy (push) Successful in 7s

This commit is contained in:
2026-03-27 20:22:17 -05:00
parent 12d1e65ed5
commit 5afd9057f2
6 changed files with 102 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
import { defineStore } from "pinia";
import type { User } from "../models/User.ts";
import * as usersApi from "../api/UsersApi";
interface UserState {
users: User[];
loading: boolean;
}
export const useUsersStore = defineStore("users", {
state: (): UserState => ({
users: [],
loading: false
}),
actions: {
async fetchUsers() {
this.loading = true;
const response = await usersApi.getUsers();
this.users = response.data;
this.loading = false;
},
async removeUser(id: number) {
await usersApi.deleteUser(id);
this.users = this.users.filter(i => i.id !== id);
}
}
});