Skip to content

fetchagain is not a function #58

@VivekLumbhani

Description

@VivekLumbhani

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions