test
Browse files
app/{api/logo/route.ts β _actions/logos.ts}
RENAMED
@@ -1,6 +1,8 @@
|
|
|
|
|
|
1 |
import prisma from "@/_utils/prisma";
|
2 |
|
3 |
-
export async
|
4 |
const images = await prisma.logo.findMany({
|
5 |
select: {
|
6 |
id: true,
|
@@ -10,5 +12,5 @@ export async function GET() {
|
|
10 |
id: "desc",
|
11 |
},
|
12 |
});
|
13 |
-
return
|
14 |
-
}
|
|
|
1 |
+
"use server";
|
2 |
+
|
3 |
import prisma from "@/_utils/prisma";
|
4 |
|
5 |
+
export const getLogos = async () => {
|
6 |
const images = await prisma.logo.findMany({
|
7 |
select: {
|
8 |
id: true,
|
|
|
12 |
id: "desc",
|
13 |
},
|
14 |
});
|
15 |
+
return images.map((image) => image.id);
|
16 |
+
};
|
app/page.tsx
CHANGED
@@ -1,17 +1,16 @@
|
|
|
|
1 |
import { Gallery } from "./_components/gallery";
|
2 |
import { Generation } from "./_components/generation";
|
3 |
import { HeroHeader } from "./_components/hero-header";
|
4 |
|
5 |
-
async function
|
6 |
-
const logos = await
|
7 |
-
.then((res) => res.json())
|
8 |
-
.then((data) => data);
|
9 |
return logos;
|
10 |
}
|
11 |
export const revalidate = 0;
|
12 |
|
13 |
export default async function Home() {
|
14 |
-
const logos = await
|
15 |
return (
|
16 |
<section>
|
17 |
<div className="max-w-4xl mx-auto">
|
|
|
1 |
+
import { getLogos } from "./_actions/logos";
|
2 |
import { Gallery } from "./_components/gallery";
|
3 |
import { Generation } from "./_components/generation";
|
4 |
import { HeroHeader } from "./_components/hero-header";
|
5 |
|
6 |
+
async function lastLogos() {
|
7 |
+
const logos = await getLogos();
|
|
|
|
|
8 |
return logos;
|
9 |
}
|
10 |
export const revalidate = 0;
|
11 |
|
12 |
export default async function Home() {
|
13 |
+
const logos = await lastLogos();
|
14 |
return (
|
15 |
<section>
|
16 |
<div className="max-w-4xl mx-auto">
|