when i try updating name of the group chat(renaming of group) it says fetchagain is not a function
const handleRename = async () => {
if (!groupChatName) return;
try {
setrenameLoading(true);
const config = {
headers: {
Authorization: `Bearer ${user.token}`
}
};
console.log("renamet to "+groupChatName);
var variable={
"chatId": selectedChat._id,
"name": groupChatName
}
console.log("details to rename "+JSON.stringify(variable));
const { data } = await axios.put("/api/chat/rename", {
chatId: selectedChat._id,
name: groupChatName
}, config);
console.log("Rename Success:", data);
setSelectedChat(data);
setFetchAgain(!fetchAgain);
setrenameLoading(false);
toast({
title: "done renaming",
status: "success",
duration: 5000,
isClosable: true,
position: "bottom",
});
} catch (error) {
console.log("error in renaming " + error);
toast({
title: "error in renaming",
status: "error",
duration: 5000,
isClosable: true,
position: "bottom",
});
setrenameLoading(false);
}
setgroupChatName("");
};
where is the problem ,have any one fixed this yet?