refactor: remove channel msg
This commit is contained in:
@@ -3,7 +3,6 @@ import toast from "react-hot-toast";
|
||||
import {
|
||||
useChangeChannelTypeMutation,
|
||||
useGetChannelQuery,
|
||||
// useLazyClearChannelMessageQuery,
|
||||
useUpdateChannelMutation,
|
||||
useUpdateIconMutation
|
||||
} from "../../app/services/channel";
|
||||
@@ -17,7 +16,7 @@ import IconChannel from "../../assets/icons/channel.svg";
|
||||
import { useAppSelector } from "../../app/store";
|
||||
import { Channel } from "../../types/channel";
|
||||
import { useTranslation } from "react-i18next";
|
||||
// import StyledButton from "../../common/component/styled/Button";
|
||||
|
||||
|
||||
export default function Overview({ id = 0 }) {
|
||||
const { t } = useTranslation("setting", { keyPrefix: "channel" });
|
||||
@@ -32,7 +31,6 @@ export default function Overview({ id = 0 }) {
|
||||
const [changed, setChanged] = useState(false);
|
||||
const [values, setValues] = useState<Channel>();
|
||||
const [updateChannelIcon] = useUpdateIconMutation();
|
||||
// const [clearMessage, { isSuccess: clearSuccess }] = useLazyClearChannelMessageQuery();
|
||||
const [updateChannel, { isSuccess: updated }] = useUpdateChannelMutation();
|
||||
const [changeChannelType, { isSuccess: changeTypeSuccess }] = useChangeChannelTypeMutation();
|
||||
const handleUpdate = () => {
|
||||
@@ -54,11 +52,7 @@ export default function Overview({ id = 0 }) {
|
||||
updateChannelIcon({ gid: id, image });
|
||||
};
|
||||
|
||||
// const handleClear = () => {
|
||||
// if (confirm("are you sure?")) {
|
||||
// clearMessage(id);
|
||||
// }
|
||||
// };
|
||||
|
||||
const handleReset = () => {
|
||||
setValues(data);
|
||||
};
|
||||
@@ -68,11 +62,7 @@ export default function Overview({ id = 0 }) {
|
||||
setValues(data);
|
||||
}
|
||||
}, [data]);
|
||||
// useEffect(() => {
|
||||
// if (clearSuccess) {
|
||||
// toast.success("Cleared!");
|
||||
// }
|
||||
// }, [clearSuccess]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (data && values) {
|
||||
@@ -145,7 +135,7 @@ export default function Overview({ id = 0 }) {
|
||||
}}
|
||||
/>
|
||||
</div>}
|
||||
{/* <StyledButton className="danger" onClick={handleClear}>Clear Message</StyledButton> */}
|
||||
|
||||
</div>
|
||||
{changed && <SaveTip saveHandler={handleUpdate} resetHandler={handleReset} />}
|
||||
</div>
|
||||
|
||||
@@ -29,7 +29,7 @@ const useNavs = (uid: number): Nav[] => {
|
||||
{
|
||||
name: "auto_delete_msg",
|
||||
title: t("nav.auto_delete_msg"),
|
||||
component: <AutoDeleteMessages id={uid} type="user" />
|
||||
component: <AutoDeleteMessages id={uid} type="dm" />
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user