Skip to content

Commit

Permalink
🐭🏟️ ↝ Sector data now visible
Browse files Browse the repository at this point in the history
  • Loading branch information
Gizmotronn committed Dec 1, 2023
1 parent e52d5bd commit 76d96b0
Showing 1 changed file with 5 additions and 22 deletions.
27 changes: 5 additions & 22 deletions components/Content/Planets/IndividualPlanet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ export default function IndividualPlanet({ id }: { id: string }) {
if (planetId) {
getPlanetData();
fetchPostsForPlanet(id);
// fetchSectorsForPlanet(inventoryPlanetId);
fetchSectorsForPlanetTest();
fetchSectorsForPlanet();
checkUserInventory();
}
});
}, [session]);

const getPlanetData = async () => {
try {
Expand Down Expand Up @@ -126,29 +125,13 @@ export default function IndividualPlanet({ id }: { id: string }) {
};
};

async function fetchSectorsForPlanet(planetId: string) {
async function fetchSectorsForPlanet() {
try {
const { data, error } = await supabase
.from('planetsssSECTORS')
.select('*')
.eq('planetId', inventoryPlanetId);

if (error) {
console.error('Error fetching sectors data:', error.message);
return;
};

setSectors(data);
} catch (error) {
console.error(error);
};
};

async function fetchSectorsForPlanetTest() {
try {
const { data, error } = await supabase
.from('planetsssSECTORS')
.select('*')
setSectors(data);

if (error) {
console.error('Error fetching sectors data:', error.message);
Expand Down Expand Up @@ -239,7 +222,7 @@ export default function IndividualPlanet({ id }: { id: string }) {
{hasPlanetInInventory && (<>
<p>{inventoryPlanetId}</p>
<RoverGallerySingle inventoryPlanetId={inventoryPlanetId} />
{/* <PlanetSector sectors={sectors} /> */}
<PlanetSector sectors={sectors} />
</>)}
</div>
</LayoutNoNav>
Expand Down

0 comments on commit 76d96b0

Please sign in to comment.