forked from EGCETSII/decide_django_2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request EGCETSII#39 from Full-Tortuga/feature/EGCETSII#17-…
…list-users-and-provide-actions EGCETSII#17-feat: fetch data for user list and provide state/role actions
- Loading branch information
Showing
8 changed files
with
186 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
{ | ||
"folders": [ | ||
{ | ||
"path": "." | ||
}, | ||
{ | ||
"path": "decide/administration" | ||
}, | ||
{ | ||
"path": "decide/administration/frontend" | ||
} | ||
], | ||
"settings": {} | ||
"folders": [ | ||
{ | ||
"name": "decide-full-tortuga-admin", | ||
"path": "." | ||
}, | ||
{ | ||
"name": "decide", | ||
"path": "decide" | ||
}, | ||
{ | ||
"name": "administration", | ||
"path": "decide/administration" | ||
}, | ||
{ | ||
"name": "src", | ||
"path": "decide/administration/frontend/src" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,35 @@ | ||
import { axios } from "api/axios"; | ||
import { userType } from "types"; | ||
|
||
const userApi = { | ||
// bulk operations | ||
// bulk simple operations | ||
getUsers: () => axios.get("/users"), | ||
//createUsers: (user: any) => axios.post("/users/", user), | ||
deleteUsers: () => axios.delete("/users"), | ||
deleteUsers: (idList: number[]) => | ||
axios.delete("/users", { data: { idList: idList.join(",") } }), | ||
|
||
// individual operations | ||
// bulk role/status operations | ||
updateUsersActive: (idList: number[], value: boolean) => | ||
axios.post("/users/state", { | ||
idList: idList.join(","), | ||
state: "Active", | ||
value: value ? "True" : "False", | ||
}), | ||
updateUsersRole: ( | ||
idList: number[], | ||
value: boolean, | ||
role: "Staff" | "Superuser" | ||
) => | ||
axios.post("/users/state", { | ||
idList: idList.join(","), | ||
state: role, | ||
value: value ? "True" : "False", | ||
}), | ||
|
||
// individual simple operations | ||
getUser: (id: string) => axios.get(`/users/${id}`), | ||
createUser: (user: any) => axios.post("/users", user), | ||
updateUser: (user: any) => axios.put(`/users/${user.id}`, user), | ||
createUser: (user: userType.User) => axios.post("/users", user), | ||
updateUser: (user: userType.User) => axios.put(`/users/${user.id}`, user), | ||
deleteUser: (id: string) => axios.delete(`/users/${id}`), | ||
}; | ||
|
||
|
||
export default userApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
//todo replace with user correct data | ||
export type User = { | ||
id: number; | ||
lastName: string; | ||
firstName?: string | null; | ||
age?: number | null; | ||
email: string; | ||
first_name: string; | ||
last_name: string; | ||
username: string; | ||
is_active: boolean; | ||
is_staff: boolean; | ||
is_superuser: boolean; | ||
}; |