It's really annoying to wait for the modules to be loaded while visiting the user profile or admin panel.
31 lines
747 B
JavaScript
31 lines
747 B
JavaScript
import React from "react";
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
|
|
import { PolochonList } from "../polochons/list";
|
|
import { UserEdit } from "./edit";
|
|
|
|
import { getUserModules } from "../../actions/users";
|
|
import Modules from "../modules/modules";
|
|
|
|
export const UserProfile = () => {
|
|
const dispatch = useDispatch();
|
|
const modules = useSelector((state) => state.user.modules);
|
|
const modulesLoading = useSelector((state) => state.user.modulesLoading);
|
|
|
|
const fetchModules = () => {
|
|
dispatch(getUserModules());
|
|
};
|
|
|
|
return (
|
|
<div>
|
|
<UserEdit />
|
|
<PolochonList />
|
|
<Modules
|
|
modules={modules}
|
|
isLoading={modulesLoading}
|
|
fetchModules={fetchModules}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|