merge
This commit is contained in:
commit
9903c72ff5
1 file changed
+5
-4
@@ -20,7 +20,8 @@ import { useEffect, useState } from "react";
|
||||
import { DialogInput } from "@/Components/inputs/Dialog";
|
||||
import { useSelector } from "react-redux";
|
||||
import type { RootState } from "@/Types/state";
|
||||
import { LAYOUT, SPACING } from "@/Utils/Theme/constants";
|
||||
import { LAYOUT } from "@/Utils/Theme/constants";
|
||||
import { useIsAdmin, useIsSuperAdmin } from "@/Hooks/useIsAdmin";
|
||||
|
||||
interface RoleOption {
|
||||
id: UserRole;
|
||||
@@ -37,8 +38,8 @@ const EditUserPage = () => {
|
||||
const navigate = useNavigate();
|
||||
const [showDeleteDialog, setShowDeleteDialog] = useState(false);
|
||||
const currentUser = useSelector((state: RootState) => state.auth.user);
|
||||
const isSuperAdmin = currentUser?.role?.includes("superadmin") ?? false;
|
||||
const isAdmin = isSuperAdmin || (currentUser?.role?.includes("admin") ?? false);
|
||||
const isSuperAdmin = useIsSuperAdmin();
|
||||
const isAdmin = useIsAdmin();
|
||||
|
||||
const { data: user, isLoading } = useGet<User>(`/auth/users/${userId}`);
|
||||
|
||||
@@ -78,8 +79,8 @@ const EditUserPage = () => {
|
||||
|
||||
const handleDeleteUser = async () => {
|
||||
const result = await deleteFn(`/auth/users/${userId}`);
|
||||
setShowDeleteDialog(false);
|
||||
if (result) {
|
||||
setShowDeleteDialog(false);
|
||||
navigate("/account", { state: { tab: "team" } });
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user