This commit is contained in:
Janis
2023-01-29 20:01:56 +01:00
parent d3e5295832
commit bc29de3255
119 changed files with 26881 additions and 0 deletions

24
app/admin/images/page.tsx Normal file
View File

@@ -0,0 +1,24 @@
import React from "react";
import { Image } from "@prisma/client";
import { Image as GalleryImage } from "react-grid-gallery";
import urlJoin from "url-join";
import { apiUrl } from "../../../global";
import Gallery from "./Gallery";
async function getImages(): Promise<GalleryImage[]> {
const result = await fetch(urlJoin(apiUrl, `images`), {
cache: "no-cache",
});
const imageData: Image[] = await result.json();
return imageData.map((img, i) => ({
width: img.width,
height: img.height,
src: img.url,
caption: img.name,
}));
}
export default async function AdminImagesPage() {
return <Gallery images={await getImages()} />;
}