add crud to api
All checks were successful
Build and Deploy Frontend / build-and-deploy (push) Successful in 6s

This commit is contained in:
2026-03-10 22:49:14 -05:00
parent 728258465d
commit 9b6a4c75b9
12 changed files with 172 additions and 61 deletions

View File

@@ -7,14 +7,18 @@ import axios from "axios";
import type {AxiosResponse } from "axios";
import type { User } from "../models/User.ts";
const API_URL: string = "/api/items";
const API_URL: string = "/users";
export const getUsers = () => axios.get<User[]>(API_URL);
const api = axios.create({
baseURL: "http://10.145.164.106:5227/api"
});
export const getUser = (id: number) => axios.get<User>(`${API_URL}/${id}`);
export const getUsers = () => api.get<User[]>(`${API_URL}`);
export const createUser = (data: User) => axios.post<User>(API_URL, data);
export const getUser = (id: number) => api.get<User>(`${API_URL}/${id}`);
export const updateUser = (id: number, data: User) => axios.put<User>(`${API_URL}/${id}`, data);
export const createUser = (data: User) => api.post<User>(`${API_URL}`, data);
export const deleteUser = (id: number) => axios.delete<User>(`${API_URL}/${id}`);
export const updateUser = (id: number, data: User) => api.put<User>(`${API_URL}/${id}`, data);
export const deleteUser = (id: number) => api.delete<User>(`${API_URL}/${id}`);