fix: delete channel and remove remembered navs
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// import React from "react";
|
||||
import { useEffect } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { useNavigate, useMatch } from "react-router-dom";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import Modal from "../../common/component/Modal";
|
||||
import { useLazyRemoveChannelQuery } from "../../app/services/channel";
|
||||
import StyledModal from "../../common/component/styled/Modal";
|
||||
@@ -9,7 +9,7 @@ import Button from "../../common/component/styled/Button";
|
||||
|
||||
export default function DeleteConfirmModal({ id, closeModal }) {
|
||||
const navigateTo = useNavigate();
|
||||
const pathMatched = useMatch(`/chat/channel/${id}`);
|
||||
// const pathMatched = useMatch(`/chat/channel/${id}`);
|
||||
const [deleteChannel, { isLoading, isSuccess }] = useLazyRemoveChannelQuery();
|
||||
const handleDelete = () => {
|
||||
deleteChannel(id);
|
||||
@@ -20,7 +20,7 @@ export default function DeleteConfirmModal({ id, closeModal }) {
|
||||
closeModal();
|
||||
navigateTo("/chat");
|
||||
}
|
||||
}, [isSuccess, id, pathMatched]);
|
||||
}, [isSuccess]);
|
||||
if (!id) return null;
|
||||
return (
|
||||
<Modal id="modal-modal">
|
||||
|
||||
Reference in New Issue
Block a user