Sfoglia il codice sorgente

basic用户不能创建

visuddhinanda 2 anni fa
parent
commit
4a6c098dda
1 ha cambiato i file con 6 aggiunte e 1 eliminazioni
  1. 6 1
      dashboard/src/pages/studio/course/list.tsx

+ 6 - 1
dashboard/src/pages/studio/course/list.tsx

@@ -39,6 +39,8 @@ import {
   studentCanDo,
 } from "../../../components/course/RolePower";
 import { ISetStatus, setStatus } from "../../../components/course/UserAction";
+import { useAppSelector } from "../../../hooks";
+import { currentUser } from "../../../reducers/current-user";
 
 interface DataItem {
   sn: number;
@@ -86,6 +88,7 @@ const Widget = () => {
   const [studyNumber, setStudyNumber] = useState<number>(0);
   const ref = useRef<ActionType>();
   const [openCreate, setOpenCreate] = useState(false);
+  const user = useAppSelector(currentUser);
 
   useEffect(() => {
     /**
@@ -455,7 +458,9 @@ const Widget = () => {
             }}
           >
             <Button
-              disabled={activeKey !== "create"}
+              disabled={
+                activeKey !== "create" || user?.roles?.includes("basic")
+              }
               key="button"
               icon={<PlusOutlined />}
               type="primary"