mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 20:59:16 +00:00
Merge last commit
This commit is contained in:
@@ -52,14 +52,9 @@ const useStyles = makeStyles(theme => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const ContactModal = ({
|
const ContactModal = ({ modalOpen, onClose, contactId }) => {
|
||||||
modalOpen,
|
|
||||||
setModalOpen,
|
|
||||||
handleAddContact,
|
|
||||||
onClose,
|
|
||||||
contactId,
|
|
||||||
}) => {
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
name: "",
|
name: "",
|
||||||
number: "",
|
number: "",
|
||||||
@@ -90,11 +85,15 @@ const ContactModal = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleSaveContact = async values => {
|
const handleSaveContact = async values => {
|
||||||
|
try {
|
||||||
if (contactId) {
|
if (contactId) {
|
||||||
await api.put(`/contacts/${contactId}`, values);
|
await api.put(`/contacts/${contactId}`, values);
|
||||||
} else {
|
} else {
|
||||||
await api.post("/contacts", values);
|
await api.post("/contacts", values);
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
alert(err);
|
||||||
|
}
|
||||||
handleClose();
|
handleClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -179,7 +179,11 @@ const Contacts = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDeleteContact = async contactId => {
|
const handleDeleteContact = async contactId => {
|
||||||
|
try {
|
||||||
await api.delete(`/contacts/${contactId}`);
|
await api.delete(`/contacts/${contactId}`);
|
||||||
|
} catch (err) {
|
||||||
|
alert(err);
|
||||||
|
}
|
||||||
setDeletingContact(null);
|
setDeletingContact(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user