From cda2a1ef15477d1df3ceaeab1c6f9c40cc5dbea9 Mon Sep 17 00:00:00 2001
From: rfhferreira <rfhferreira@inf.ufpr.br>
Date: Thu, 20 Mar 2025 17:07:58 -0300
Subject: [PATCH] Issue #270: FIX collection order on coll page

---
 src/app/colecao/[id]/components/collectionItems.js | 2 +-
 src/app/colecao/[id]/page.js                       | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/app/colecao/[id]/components/collectionItems.js b/src/app/colecao/[id]/components/collectionItems.js
index 4ab3b06a..567a5024 100644
--- a/src/app/colecao/[id]/components/collectionItems.js
+++ b/src/app/colecao/[id]/components/collectionItems.js
@@ -8,7 +8,7 @@ export default function CollectionItems({ collection }) {
         <div className="flex flex-col bg-white p-4 rounded-lg">
             <div className="text-main-text font-bold text-xl mb-3">Recursos na coleção</div>
             <div className="flex flex-col gap-3">
-                {collection.collection_items.map((item, index) => {
+                {collection.collection_items.sort((a,b) => a.position - b.position).map((item, index) => {
                     return (
                         <Cards
                             collectionSource={collection["id"]}
diff --git a/src/app/colecao/[id]/page.js b/src/app/colecao/[id]/page.js
index e20042f1..b31d7bf8 100644
--- a/src/app/colecao/[id]/page.js
+++ b/src/app/colecao/[id]/page.js
@@ -39,9 +39,7 @@ export default function Colecao({ params }) {
           };
         }
 
-        const response = await mecredApi.get(`collections/${params.id}`, {
-          headers: headers,
-        });
+        const response = await mecredApi.get(`collections/${params.id}`);
 
         setCollection(response.data);
       } catch (error) {
-- 
GitLab