refactor: more TS code
This commit is contained in:
@@ -36,7 +36,7 @@ const InvitePage: FC = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (checkSuccess) {
|
||||
setValid(isValid);
|
||||
setValid(!!isValid);
|
||||
} else {
|
||||
setValid(false);
|
||||
}
|
||||
|
||||
@@ -80,6 +80,9 @@ export default function LoginPage() {
|
||||
"No associated account found, please user admin for an invitation link to join."
|
||||
);
|
||||
break;
|
||||
case 451:
|
||||
toast.error("License error: Domain incorrect!");
|
||||
break;
|
||||
default:
|
||||
toast.error("Something Error");
|
||||
break;
|
||||
|
||||
@@ -4,20 +4,19 @@ import StyledSettingContainer from "../../common/component/StyledSettingContaine
|
||||
import useNavs from "./navs";
|
||||
import LogoutConfirmModal from "./LogoutConfirmModal";
|
||||
|
||||
let from: string = "";
|
||||
let pageFrom: string = "";
|
||||
|
||||
export default function Setting() {
|
||||
const [searchParams] = useSearchParams();
|
||||
const navs = useNavs();
|
||||
const flattenNaves = navs.map(({ items }) => items).flat();
|
||||
const navKey = searchParams.get("nav");
|
||||
from = from ?? (searchParams.get("f") || "/");
|
||||
const [logoutConfirm, setLogoutConfirm] = useState(false);
|
||||
const navigateTo = useNavigate();
|
||||
pageFrom = pageFrom ? pageFrom : searchParams.get("f") || "/";
|
||||
const close = () => {
|
||||
// todo: check usage
|
||||
navigateTo(from!);
|
||||
from = "";
|
||||
navigateTo(pageFrom);
|
||||
pageFrom = "";
|
||||
};
|
||||
|
||||
const toggleLogoutConfirm = () => {
|
||||
|
||||
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user