Skip to content

Commit

Permalink
EGCETSII#16-feat: Added Census API util and Census type
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrabled committed Jan 2, 2022
1 parent 5a1e87a commit 5463160
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions decide/administration/frontend/src/api/censusApiUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { axios } from "api/axios";
import { Census } from "types/census";


const censusApi = {
//Bulk operation
getCensuss: () => axios.get("/census"),
deleteCensuss: () => axios.delete(`/census`),


//Individual operations
getCensus: (id: string) => axios.get(`/census/${id}`),
createCensus: (census: Census) => axios.post("/census/", census),
updateCensus: (census: Census) => axios.put(`/census/${census.id}`, census),
deleteCensus: (id: string) => axios.delete(`/census/${id}`),
};


export default censusApi;
5 changes: 5 additions & 0 deletions decide/administration/frontend/src/types/census.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type Census = {
id : number;
voting_Id : number;
voter_Id : number;
};

0 comments on commit 5463160

Please sign in to comment.