Skip to content

Commit

Permalink
fix: move function to top to avoid init error
Browse files Browse the repository at this point in the history
  • Loading branch information
fboulnois committed Jan 9, 2024
1 parent e882226 commit e1598fe
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/pages/manage_dac/ManageDac.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ export const ManageDac = function ManageDac() {
const [selectedDatasets, setSelectedDatasets] = useState([]);


const reloadDacList = useCallback(async () => {
setIsLoading(true);
DAC.list().then(
dacs => {
if (userRole === CHAIR) {
dacs = dacs.filter((dac) => dacIDs.includes(dac.dacId));
}
setDacs(dacs);
setIsLoading(false);
}
);
}, [dacIDs, userRole]);

useEffect(() => {
Promise.all([
reloadUserRole(),
Expand All @@ -55,20 +68,6 @@ export const ManageDac = function ManageDac() {
}
};

const reloadDacList = useCallback(async () => {
setIsLoading(true);
DAC.list().then(
dacs => {
if (userRole === CHAIR) {
dacs = dacs.filter((dac) => dacIDs.includes(dac.dacId));
}
setDacs(dacs);
setIsLoading(false);
}
);
}, [dacIDs, userRole]);


const reloadUserRole = useCallback(async () => {
setIsLoading(true);
const currentUser = Storage.getCurrentUser();
Expand Down

0 comments on commit e1598fe

Please sign in to comment.