Skip to content
Snippets Groups Projects
Commit c7f6cb03 authored by Guilherme Eduardo's avatar Guilherme Eduardo
Browse files

wip issue-294

parent a373fb13
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,8 @@ import Loading from "@/app/components/Loading"; ...@@ -15,6 +15,8 @@ import Loading from "@/app/components/Loading";
* *
*/ */
export default function ProfileResources({ id, idLogin }) { export default function ProfileResources({ id, idLogin }) {
//Concateno tanto os arrays de recursos em homologação quanto aceitos
const [uniqueResources, setUniqueResources] = useState([])
const [resources, setResources] = useState([]) const [resources, setResources] = useState([])
const [homologaResources, setHomologaResources] = useState([]) const [homologaResources, setHomologaResources] = useState([])
const token = getStoredValue("access_token") const token = getStoredValue("access_token")
...@@ -48,6 +50,7 @@ export default function ProfileResources({ id, idLogin }) { ...@@ -48,6 +50,7 @@ export default function ProfileResources({ id, idLogin }) {
.catch((error) => { .catch((error) => {
console.error(error); console.error(error);
}); });
}; };
const fetchSubmissions = async (id) => { const fetchSubmissions = async (id) => {
...@@ -85,6 +88,20 @@ export default function ProfileResources({ id, idLogin }) { ...@@ -85,6 +88,20 @@ export default function ProfileResources({ id, idLogin }) {
setTotalCount(resourcesCount + homologaCount) setTotalCount(resourcesCount + homologaCount)
}, [resourcesCount, homologaCount]) }, [resourcesCount, homologaCount])
useEffect(() => {
// Remove os itens duplicados - Set é uma estrutura de dados
// que não aceita repetição
if (resources.length > 0 || homologaResources.length > 0) {
const unificado = [...resources, ...homologaResources];
const remove_duplicates = [... new Set (unificado)]
setUniqueResources(remove_duplicates);
}
}, [resources, homologaResources]);
console.log ("Recursos: ", resources)
console.log ("Homologados: ", homologaResources)
console.log ("Unificado: ", uniqueResources)
return ( return (
<> <>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment