Conversation
3f60e34 to
f0b1832
Compare
client/src/api/axios.ts
Outdated
| async function Search(searchInput:any) { | ||
| await AuthClient.get(`/members/search/${searchInput}`) | ||
| .then(response=>{ | ||
| console.log('Search results:', response.data); |
client/src/api/axios.ts
Outdated
| await AuthClient.get(`/members/search/${searchInput}`) | ||
| .then(response=>{ | ||
| return response.data; | ||
| }) | ||
| .catch(error=>{ | ||
| console.error(error); | ||
| }) | ||
| } |
There was a problem hiding this comment.
| await AuthClient.get(`/members/search/${searchInput}`) | |
| .then(response=>{ | |
| return response.data; | |
| }) | |
| .catch(error=>{ | |
| console.error(error); | |
| }) | |
| } | |
| return await AuthClient.get(`/members/search/${searchInput}`) | |
| } | |
and handle it with try and catch when you call it
client/src/pages/AddMembers.vue
Outdated
| <v-row > | ||
| <p class="mt-2 text-h4 text-blue-darken-4" variant="h5">ALL MEMBERS</p> | ||
| <v-spacer></v-spacer> | ||
| <v-btn color="primary" @click="addMemberDialog=true"> |
client/src/pages/AddMembers.vue
Outdated
| <v-card-actions> | ||
| <v-spacer></v-spacer> | ||
| <v-btn color="info" @click="addMemberDialog = false">Close</v-btn> | ||
| <v-btn color="success" @click="addMember">ADD+</v-btn> |
client/src/pages/AddMembers.vue
Outdated
| // take userinfo | ||
| }; | ||
|
|
||
| const SearchMember = async () => { |
Mahmoud-Emad
left a comment
There was a problem hiding this comment.
Good job ya Nabila, some comments
client/src/pages/AddMembers.vue
Outdated
| required: true, | ||
| }, | ||
| project_id: { | ||
| type: string, |
There was a problem hiding this comment.
Please use String instead
client/src/api/axios.ts
Outdated
|
|
||
| const AuthClient: AxiosInstance = axios.create({ | ||
| baseURL: import.meta.env.VITE_APP_ENDPOINT, | ||
| baseURL: import.meta.env.VITE_APP_ENDPOINT, |
There was a problem hiding this comment.
Load it from the window instead
client/src/api/axios.ts
Outdated
| return await AuthClient.get(`/members/search/${searchInput}`) | ||
| } | ||
| async function getProjectMembers (projectId:any) { | ||
| return await AuthClient.get(`/members/project/${projectId}/members/`) |
There was a problem hiding this comment.
use members without projects, should be /api/members/all/
use this endpoint /members/project/${projectId}/members/ only inside an active project
| <div style="margin-left: 7cm; margin-right: 7cm;"> | ||
| <v-container> | ||
| <v-row> |
There was a problem hiding this comment.
You need to load the navbar here
client/src/pages/AddMembers.vue
Outdated
| color="primary" | ||
| @click="addMemberDialog=true" | ||
| > | ||
| INVITE MEMBERS |
There was a problem hiding this comment.
| INVITE MEMBERS | |
| Invite member |
client/src/pages/AddMembers.vue
Outdated
| <div style="margin-left: 7cm; margin-right: 7cm;"> | ||
| <v-container> | ||
| <v-row> | ||
| <p class="mt-2 text-h4 text-blue-darken-4" variant="h5">ALL MEMBERS</p> |
There was a problem hiding this comment.
| <p class="mt-2 text-h4 text-blue-darken-4" variant="h5">ALL MEMBERS</p> | |
| <p class="mt-2 text-h4 text-blue-darken-4" variant="h5">All members</p> |
client/src/pages/AddMembers.vue
Outdated
| v-model="inviteNewMember.first_name" | ||
| density="compact" | ||
| placeholder="First Name" | ||
| prepend-inner-icon="mdi-account-outline" | ||
| variant="outlined" |
There was a problem hiding this comment.
Add the validation rules, and apply it to all inputs
| <p>Permission</p> | ||
| <v-select | ||
| :items="['Full access', 'Admin access']" | ||
| label="Select" | ||
| /> |
There was a problem hiding this comment.
| <p>Permission</p> | |
| <v-select | |
| :items="['Full access', 'Admin access']" | |
| label="Select" | |
| /> | |
| <v-select | |
| :items="['Full access', 'Admin access']" | |
| label="Permission" | |
| /> |
also, use an enum to normalizre the value, the backend require an exact pattern see the enum there
class PERMISSION_CHOICES(models.TextChoices):
FULL_ACCESS = "full_access", "Full access"
ADMIN_ACCESS = "admin_access", "Admin access"so you need to send the full_access or admin_access as the value
| <p>Permission</p> | |
| <v-select | |
| :items="['Full access', 'Admin access']" | |
| label="Select" | |
| /> | |
| <v-select | |
| :items="[{name: "Full access" value: 'full_access'}, {name: 'Admin access', value: 'admin_access'}]" | |
| label="Permission" | |
| /> |
client/src/pages/AddMembers.vue
Outdated
| const inviteNewMember = ref({ | ||
| first_name: '', | ||
| last_name: '', | ||
| email: '', | ||
| }) |
There was a problem hiding this comment.
Better to define an interface for the data
client/src/pages/AddMembers.vue
Outdated
| notifier.notify({ | ||
| title: 'success', | ||
| description: 'member added successfully', | ||
| showProgressBar: true, | ||
| timeout: 7_000, | ||
| type: 'success', | ||
| }) |
There was a problem hiding this comment.
The message will be returned from the backend
client/src/api/axios.ts
Outdated
| baseURL: window.location.origin, | ||
| timeout: 1000, | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| 'Authorization': 'Bearer ' + localStorage.getItem("token"), | ||
| Authorization: 'Bearer ' + localStorage.getItem('token'), | ||
| }, | ||
| }); | ||
| }) | ||
|
|
||
| const BaseClient: AxiosInstance = axios.create({ | ||
| baseURL: import.meta.env.VITE_APP_ENDPOINT, | ||
| baseURL: window.location.origin, |
There was a problem hiding this comment.
We should use window.env.SERVER_DOMAIN_NAME_API instead
client/src/api/axios.ts
Outdated
| }) | ||
|
|
||
| export { AuthClient, BaseClient }; | ||
| async function search (searchInput:any) { |
There was a problem hiding this comment.
As we agreed we need to define the types of the parameters
server/test_tracker/views/member.py
Outdated
|
|
||
| serializer_class = MemberSerializers | ||
| permission_classes = (IsHost,) | ||
| # permission_classes = (IsHost,) |
There was a problem hiding this comment.
Please don't commit the commented code
Description
Add members page
Changes
Related issues
#19