diff --git a/components/Submissions/FondApplications.tsx b/components/Submissions/FondApplications.tsx
index d865510..a219e22 100644
--- a/components/Submissions/FondApplications.tsx
+++ b/components/Submissions/FondApplications.tsx
@@ -1,22 +1,16 @@
-'use client';
-import useSWR from 'swr';
-import ErrorPage from '../all/Error';
import ApplicationCard, { SkeletonApplication } from './ApplicationCard';
import { ApplicationType } from '@/lib/types';
+import { prisma } from '@/lib/prisma';
-const fetcher = (url: string) => fetch(url).then((res) => res.json());
-
-const FondApplications = () => {
- const { data, error } = useSWR('/api/admin/application', fetcher);
-
- if (error) return ;
+const FondApplications = async () => {
+ const applications = await prisma.application.findMany({});
return (
Søknader til fondet
- {data
- ? data.applications.map((application: ApplicationType) => (
+ {applications
+ ? applications.map((application: ApplicationType) => (
))
: Array.from({ length: 2 }).map((_, index) => (
diff --git a/lib/types.ts b/lib/types.ts
index 4a1e450..93028f3 100644
--- a/lib/types.ts
+++ b/lib/types.ts
@@ -13,13 +13,13 @@ export type MemberType = {
export type ApplicationType = {
id: number;
purpose: string;
- description?: string;
+ description?: string | null;
grantedAmount: number;
amountApplied: number;
recipient: string;
dateApplied: Date;
dateGranted: Date;
- attachment: string;
+ attachment: string | null;
};
export type CompositionType = {