fix: delete channel and remove remembered navs

This commit is contained in:
zerosoul
2022-05-24 23:12:55 +08:00
parent 1f6bfa1629
commit d649c46c21
2 changed files with 13 additions and 4 deletions
@@ -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">