add crud to api
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:
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user