diff --git a/src/pages/department/compenents/update.tsx b/src/pages/department/compenents/update.tsx index 9066a5b..c16a62f 100644 --- a/src/pages/department/compenents/update.tsx +++ b/src/pages/department/compenents/update.tsx @@ -30,13 +30,6 @@ export const DepartmentUpdate: React.FC = ({ getParams(); }, [open]); - useEffect(() => { - if (id === 0) { - return; - } - getDetail(); - }, [id]); - const getParams = () => { department.createDepartment().then((res: any) => { const departments = res.data.departments; @@ -48,6 +41,10 @@ export const DepartmentUpdate: React.FC = ({ }); setDepartments(new_arr); } + if (id === 0) { + return; + } + getDetail(); }); }; diff --git a/src/pages/resource/resource-category/compenents/update.tsx b/src/pages/resource/resource-category/compenents/update.tsx index 3b085a8..1c7d7b5 100644 --- a/src/pages/resource/resource-category/compenents/update.tsx +++ b/src/pages/resource/resource-category/compenents/update.tsx @@ -30,13 +30,6 @@ export const ResourceCategoryUpdate: React.FC = ({ getParams(); }, [open]); - useEffect(() => { - if (id === 0) { - return; - } - getDetail(); - }, [id]); - const getParams = () => { resourceCategory.createResourceCategory().then((res: any) => { const categories = res.data.categories; @@ -48,6 +41,10 @@ export const ResourceCategoryUpdate: React.FC = ({ }); setCategories(new_arr); } + if (id === 0) { + return; + } + getDetail(); }); };