Skip to content
Snippets Groups Projects
Commit 5c2fdc10 authored by mcs22's avatar mcs22
Browse files

Issue #269: profile bugs

parent fb932f01
Branches
No related tags found
1 merge request!253Issue #269: profile bugs
Pipeline #41422 passed
......@@ -42,7 +42,10 @@ export default function FollowersCards({ id, count }) {
};
fetchData();
}, [id, numberCards, token, client, uid, expiry]);
// token changes after each request so if we put as dependecy it will keep changing and make more than one request.
// to solve this we probably need useContext.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [id, numberCards, client, uid, expiry]);
const toggleContent = () => {
setNumberCards((prevNumberCards) => prevNumberCards + 12);
......
......@@ -21,7 +21,6 @@ export default function FollowingCards({ id, count }) {
const uid = getStoredValue("uid");
const expiry = getStoredValue("expiry");
const [got, setGot] = useState(false);
useEffect(() => {
const fetchData = async () => {
try {
......@@ -42,7 +41,10 @@ export default function FollowingCards({ id, count }) {
};
fetchData();
}, [id, numberCards, token, client, uid, expiry]);
// token changes after each request so if we put as dependecy it will keep changing and make more than one request.
// to solve this we probably need useContext.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [id, numberCards, client, uid, expiry]);
const toggleContent = () => {
setNumberCards((prevNumberCards) => prevNumberCards + 12);
......
......@@ -69,10 +69,13 @@ export default function ProfileResources({ id, idLogin }) {
console.error(error);
});
};
idLogin === id
fetchLearningObjects(id);
fetchSubmissions(id);
}, [id, numberCards, token, client, uid, expiry]);
//só aparece os recursos em homologação se o perfil acessado for o mesmo do logado
if (idLogin === id) fetchSubmissions(id);
}, [id, numberCards, token, client, uid, expiry, idLogin]);
const toggleContent = () => {
setNumberCards(numberCards + 12)
......
......@@ -51,7 +51,7 @@ export default function Recurso({ params }) {
};
}
const response = await mecredApi.get(`learning_objects/${params.id}`);
const response = await mecredApi.get(`learning_objects/${params.id}`, { headers });
setLearningObject(response.data);
setState(response.data.state === "submitted");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment