recall usebucket hook after delete and create contact.
This commit is contained in:
parent
1c8461e72a
commit
e03d1b4e99
@ -48,7 +48,7 @@ const Directory = ({IsPage=true,prefernceContacts}) =>
|
|||||||
const { contacts, loading , refetch} = useDirectory(IsActive,projectPrefernce);
|
const { contacts, loading , refetch} = useDirectory(IsActive,projectPrefernce);
|
||||||
const { contactCategory, loading: contactCategoryLoading } =
|
const { contactCategory, loading: contactCategoryLoading } =
|
||||||
useContactCategory();
|
useContactCategory();
|
||||||
const {buckets} = useBuckets();
|
const {buckets,refetch:refetchBucket} = useBuckets();
|
||||||
|
|
||||||
const submitContact = async (data) => {
|
const submitContact = async (data) => {
|
||||||
try {
|
try {
|
||||||
@ -74,6 +74,7 @@ const Directory = ({IsPage=true,prefernceContacts}) =>
|
|||||||
// cacheData("Contacts", {data:updatedContacts,isActive:IsActive});
|
// cacheData("Contacts", {data:updatedContacts,isActive:IsActive});
|
||||||
// setContactList(updatedContacts);
|
// setContactList(updatedContacts);
|
||||||
refetch( IsActive, prefernceContacts )
|
refetch( IsActive, prefernceContacts )
|
||||||
|
refetchBucket()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const msg =
|
const msg =
|
||||||
error.response?.data?.message ||
|
error.response?.data?.message ||
|
||||||
@ -106,6 +107,7 @@ const handleDeleteContact = async (overrideId = null) => {
|
|||||||
showToast(`Contact ${IsActive ? "Deleted":"Restored"} successfully`, "success");
|
showToast(`Contact ${IsActive ? "Deleted":"Restored"} successfully`, "success");
|
||||||
|
|
||||||
setDeleteContact( null );
|
setDeleteContact( null );
|
||||||
|
refetchBucket()
|
||||||
setDirActions({ action: false, id: null });
|
setDirActions({ action: false, id: null });
|
||||||
setDeleting(false);
|
setDeleting(false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user