turn maps page into client component
This commit is contained in:
parent
73f559f049
commit
739c9354a6
@ -1,19 +1,20 @@
|
||||
"use client"
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import Webpage from "@/app/_components/webpage";
|
||||
|
||||
export default async function MapsPage() {
|
||||
try {
|
||||
const response = await fetch("/api/maps?Page=1&Limit=10");
|
||||
const json = await response.json();
|
||||
console.log(json);
|
||||
} catch(error) {
|
||||
console.log(error);
|
||||
|
||||
return (
|
||||
<Webpage>
|
||||
<h1>No Maps!</h1>
|
||||
</Webpage>
|
||||
)
|
||||
}
|
||||
export default function MapsPage() {
|
||||
const [ingameMaps, setIngameMaps] = useState();
|
||||
|
||||
useEffect(() => {
|
||||
fetch("/api/maps?Page=1&Limit=10")
|
||||
.then(response => response.json())
|
||||
.then(setIngameMaps);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
console.log(ingameMaps);
|
||||
}, [ingameMaps]);
|
||||
|
||||
return (
|
||||
<Webpage>
|
||||
|
Loading…
x
Reference in New Issue
Block a user