Skip to content

Commit

Permalink
Merge pull request EGCETSII#32 from Full-Tortuga/feature/EGCETSII#16-…
Browse files Browse the repository at this point in the history
…API-utils

Feature/EGCETSII#16 api utils
  • Loading branch information
JSnow11 authored Dec 18, 2021
2 parents 97cdeae + d614003 commit a575a33
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
30 changes: 30 additions & 0 deletions decide/administration/frontend/src/api/baseApiUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { axios } from "api/axios";


const baseApi = {
// KEYS OPERATIONS
//Bulk operation
getKeys: () => axios.get("/base/key"),
deleteKeys: () => axios.delete(`/base/key/`),

//Individual operations
getKey: (id: string) => axios.get(`/base/key/${id}`),
createKey: (key: any) => axios.post("/base/key/", key),
updateKey: (key: any) => axios.put(`/base/key/${key.id}`, key),
deleteKey: (id: string) => axios.delete(`/base/key/${id}`),


// AUTH OPERATIONS
//Bulk operation
getAuths: () => axios.get("/base/auth"),
createAuth: (auth: any) => axios.post("/base/auth/", auth),
deleteAuths: () => axios.delete(`/base/auth`),

//Individual operations
getAuth: (id: string) => axios.get(`/base/auth/${id}`),
updateAuth: (auth: any) => axios.put(`/base/auth/${auth.id}`, auth),
deleteAuth: (id: string) => axios.delete(`/base/auth/${id}`)
};


export default baseApi;
3 changes: 3 additions & 0 deletions decide/administration/frontend/src/api/userApiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { axios } from "api/axios";
const userApi = {
// bulk operations
getUsers: () => axios.get("/users"),
//createUsers: (user: any) => axios.post("/users/", user),
deleteUsers: () => axios.delete("/users"),

// individual operations
getUser: (id: string) => axios.get(`/users/${id}`),
Expand All @@ -11,4 +13,5 @@ const userApi = {
deleteUser: (id: string) => axios.delete(`/users/${id}`),
};


export default userApi;

0 comments on commit a575a33

Please sign in to comment.