refactor: more TS code

This commit is contained in:
Tristan Yang
2022-07-14 22:22:05 +08:00
parent c2797a132c
commit 65049677e4
12 changed files with 54 additions and 33 deletions
+2 -2
View File
@@ -25,7 +25,7 @@ export default function ChannelSetting() {
})
.flat();
const navKey = searchParams.get("nav");
from = from ?? (searchParams.get("f") || "/");
from = from ? from : searchParams.get("f") || "/";
const [deleteConfirm, setDeleteConfirm] = useState(false);
const [leaveConfirm, setLeaveConfirm] = useState(false);
const close = () => {
@@ -40,7 +40,7 @@ export default function ChannelSetting() {
};
if (!cid) return null;
const currNav = flattenNavs.find((n) => n.name == navKey) || flattenNavs[0];
const canDelete = loginUser.isAdmin || channel?.owner == loginUser.uid;
const canDelete = loginUser?.is_admin || channel?.owner == loginUser?.uid;
const canLeave = !channel?.is_public;
return (