diff --git a/frontend/js/components/admins/modules.js b/frontend/js/components/admins/modules.js
index 895bb99..78f7a55 100644
--- a/frontend/js/components/admins/modules.js
+++ b/frontend/js/components/admins/modules.js
@@ -1,4 +1,4 @@
-import React, { useEffect } from "react";
+import React from "react";
import { useDispatch, useSelector } from "react-redux";
import { getAdminModules } from "../../actions/admins";
@@ -10,9 +10,15 @@ export const AdminModules = () => {
const loading = useSelector((state) => state.admin.fetchingModules);
const modules = useSelector((state) => state.admin.modules);
- useEffect(() => {
+ const fetchModules = () => {
dispatch(getAdminModules());
- }, [dispatch]);
+ };
- return ;
+ return (
+
+ );
};
diff --git a/frontend/js/components/modules/modules.js b/frontend/js/components/modules/modules.js
index 7478136..93aa798 100644
--- a/frontend/js/components/modules/modules.js
+++ b/frontend/js/components/modules/modules.js
@@ -1,4 +1,4 @@
-import React from "react";
+import React, { useState } from "react";
import Loader from "../loader/loader";
import PropTypes from "prop-types";
@@ -7,11 +7,29 @@ import { upperCaseFirst } from "../../utils";
// TODO: udpate this
import { OverlayTrigger, Tooltip } from "react-bootstrap";
-const Modules = ({ isLoading, modules }) => {
+const Modules = ({ isLoading, modules, fetchModules }) => {
+ const [show, setShow] = useState(false);
if (isLoading) {
return ;
}
+ const handleClick = () => {
+ fetchModules();
+ setShow(true);
+ };
+
+ if (!show) {
+ return (
+
+
+
+ Show modules status
+
+
+
+ );
+ }
+
return (
{Object.keys(modules).map((type) => (
@@ -23,6 +41,7 @@ const Modules = ({ isLoading, modules }) => {
Modules.propTypes = {
isLoading: PropTypes.bool.isRequired,
modules: PropTypes.object.isRequired,
+ fetchModules: PropTypes.func.isRequired,
};
export default Modules;
diff --git a/frontend/js/components/users/profile.js b/frontend/js/components/users/profile.js
index 98db391..1bdeeea 100644
--- a/frontend/js/components/users/profile.js
+++ b/frontend/js/components/users/profile.js
@@ -1,4 +1,4 @@
-import React, { useEffect } from "react";
+import React from "react";
import { useDispatch, useSelector } from "react-redux";
import { PolochonList } from "../polochons/list";
@@ -12,15 +12,19 @@ export const UserProfile = () => {
const modules = useSelector((state) => state.user.modules);
const modulesLoading = useSelector((state) => state.user.modulesLoading);
- useEffect(() => {
+ const fetchModules = () => {
dispatch(getUserModules());
- }, [dispatch]);
+ };
return (
);
};