forked from VinokurovVE/tests
Servers API
This commit is contained in:
42
frontend_reactjs/src/services/ServersService.ts
Normal file
42
frontend_reactjs/src/services/ServersService.ts
Normal file
@ -0,0 +1,42 @@
|
||||
import axios, { AxiosRequestConfig } from "axios";
|
||||
import axiosInstance from "../http/axiosInstance";
|
||||
import { IHardware, IServer, IServerIP, IStorage } from "../interfaces/servers";
|
||||
import { BASE_URL } from "../constants";
|
||||
|
||||
const config: AxiosRequestConfig = {
|
||||
baseURL: BASE_URL.servers
|
||||
}
|
||||
|
||||
export default class ServerService {
|
||||
static async removeServer(server_id: number) {
|
||||
return await axiosInstance.delete(`/api/server/${server_id}`, config)
|
||||
}
|
||||
|
||||
static async addServer(data: IServer) {
|
||||
return await axiosInstance.post(`/api/server/`, data, config)
|
||||
}
|
||||
|
||||
static async removeHardware(hardware_id: number) {
|
||||
return await axiosInstance.delete(`/api/hardware/${hardware_id}`, config)
|
||||
}
|
||||
|
||||
static async addHardware(data: IHardware) {
|
||||
return await axiosInstance.post(`/api/hardware`, data, config)
|
||||
}
|
||||
|
||||
static async removeStorage(storage_id: number) {
|
||||
return await axiosInstance.delete(`/api/storage/${storage_id}`, config)
|
||||
}
|
||||
|
||||
static async addStorage(data: IStorage) {
|
||||
return await axiosInstance.post(`/api/storage`, data, config)
|
||||
}
|
||||
|
||||
static async addServerIp(data: IServerIP) {
|
||||
return await axiosInstance.post(`/api/server_ip`, data, config)
|
||||
}
|
||||
|
||||
static async removeServerIp(ip_id: number) {
|
||||
return await axiosInstance.delete(`/api/server_ip/${ip_id}`, config)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user