Resolt problema amb versió síncrona

This commit is contained in:
Pasq G 2025-01-08 01:32:40 +01:00
parent 182c1025ac
commit 6efa6956d7

View File

@ -212,7 +212,7 @@ const U = ({u, esAdministrador, setUsrSeleccionat}) => {
// zIndex: `200` // zIndex: `200`
// }} // }}
// // onMouseLeave={ev => { // // onMouseLeave={ev => {
// // setMostraMenu(false); // // setMostraMenu(false);p
// // }} // // }}
// > // >
// {/* <Link to="/c/config"> */} // {/* <Link to="/c/config"> */}
@ -453,20 +453,21 @@ export const Usuaris = () => {
// const [ambitsUSel, setAmbitsUSel] = useState([]); // const [ambitsUSel, setAmbitsUSel] = useState([]);
// (async () => { // (async () => {
let ambitsUSel = []; // let ambitsUSel = [];
useEffect(() => { useEffect(() => {
(async () => { (async () => {
const comprovaAdmin = await Roles.userIsInRoleAsync(userId, ["admin"]); const comprovaAdmin = await Roles.userIsInRoleAsync(userId, ["admin"]);
setEsEditor(comprovaAdmin); setEsEditor(comprovaAdmin);
const ambits = await Roles.getScopesForUserAsync(usrSeleccionat?._id);
setAmbitsUSel(ambits);
// console.log("ambitsUSel: ", ambitsUSel); // console.log("ambitsUSel: ", ambitsUSel);
})(); })();
}, []); }, []);
const ambitsUSel = Roles.getScopesForUser(usrSeleccionat?._id);
// setAmbitsUSel(ambits);
const rols = useTracker("rols", async () => { const rols = useTracker("rols", async () => {
return await Roles.getRolesForUserAsync(usrSeleccionat?._id); return await Roles.getRolesForUserAsync(usrSeleccionat?._id);