Skip to content
Snippets Groups Projects
Commit 0465efa4 authored by Larbi Gharib's avatar Larbi Gharib
Browse files

Contact popup information

Change-Id: I051efce504cc1e60111a24e30114199ebc2f0628
parent ac6d5430
Branches
No related tags found
No related merge requests found
...@@ -82,6 +82,7 @@ export default function Users(props) { ...@@ -82,6 +82,7 @@ export default function Users(props) {
const [progress, setProgress] = React.useState(0); const [progress, setProgress] = React.useState(0);
const [openDrawer, setOpenDrawer] = React.useState(false); const [openDrawer, setOpenDrawer] = React.useState(false);
const [removedContact, setRemovedContact] = React.useState(); const [removedContact, setRemovedContact] = React.useState();
const [removedContactName, setRemovedContactName] = React.useState();
const [open, setOpen] = React.useState(false); const [open, setOpen] = React.useState(false);
const getAllContacts = () => { const getAllContacts = () => {
...@@ -145,6 +146,28 @@ export default function Users(props) { ...@@ -145,6 +146,28 @@ export default function Users(props) {
let orginalContacts = response.data; let orginalContacts = response.data;
orginalContacts.map((contact) => { orginalContacts.map((contact) => {
contact.display = ""; contact.display = "";
axios(
configApiCall(
api_path_get_ns_name_from_addr + contact.uri,
null,
null
)
).then((response) => {
contact.name = response.data.name;
axios(
configApiCall(
api_path_get_user_profile + contact.name,
"GET",
null,
null
)
).then((response) => {
contact.profilePicture = response.data.profilePicture;
contact.firstName = response.data.firstName;
contact.lastName = response.data.lastName;
contact.organization = response.data.organization;
});
});
}); });
setContacts(orginalContacts); setContacts(orginalContacts);
setLoading(false); setLoading(false);
...@@ -195,7 +218,7 @@ export default function Users(props) { ...@@ -195,7 +218,7 @@ export default function Users(props) {
getAllContacts(); getAllContacts();
}) })
.catch((error) => { .catch((error) => {
alert("Uri: " + removedContact + " was not removed " + error); alert("Uri: " + removedContactName + " was not removed " + error);
}); });
} else { } else {
axios( axios(
...@@ -213,13 +236,14 @@ export default function Users(props) { ...@@ -213,13 +236,14 @@ export default function Users(props) {
getAllContacts(); getAllContacts();
}) })
.catch((error) => { .catch((error) => {
alert("Uri: " + removedContact + " was not removed " + error); alert("Uri: " + removedContactName + " was not removed " + error);
}); });
} }
}; };
const handleRemoveContact = (uri) => { const handleRemoveContact = (uri, name) => {
setRemovedContact(uri); setRemovedContact(uri);
setRemovedContactName(name);
setOpen(true); setOpen(true);
}; };
...@@ -243,7 +267,9 @@ export default function Users(props) { ...@@ -243,7 +267,9 @@ export default function Users(props) {
<DialogTitle id="alert-dialog-title">{"Remove contact"}</DialogTitle> <DialogTitle id="alert-dialog-title">{"Remove contact"}</DialogTitle>
<DialogContent> <DialogContent>
<DialogContentText id="alert-dialog-description"> <DialogContentText id="alert-dialog-description">
Are you sure you want to delete <strong>{removedContact}</strong> ? Are you sure you want to remove{" "}
<strong>{removedContactName}</strong> from {props.username} contacts{" "}
?
</DialogContentText> </DialogContentText>
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
...@@ -346,7 +372,7 @@ export default function Users(props) { ...@@ -346,7 +372,7 @@ export default function Users(props) {
<IconButton <IconButton
color="secondary" color="secondary"
onClick={() => { onClick={() => {
handleRemoveContact(contact.uri); handleRemoveContact(contact.uri, contact.name);
}} }}
> >
<DeleteOutlineIcon /> <DeleteOutlineIcon />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment