sw-jobs-frontend/src/app/TheHub.tsx
christian 9c2be1a2bc
Some checks failed
Vercel Production Deployment / Deploy-Production (push) Has been cancelled
updated api ip
2024-07-08 10:48:27 +02:00

46 lines
984 B
TypeScript

import { revalidatePath } from "next/cache";
import JobCard from "./_jobcard/JobCard";
interface JobPosting {
title: string;
logo: string;
company: string;
location: string;
type: string;
description: string;
link: string;
skills: {
react: boolean;
python: boolean;
golang: boolean;
svelte: boolean;
nextjs: boolean;
typescript: boolean;
tailwind: boolean;
};
}
async function fetchJobs(): Promise<JobPosting[]> {
const response = await fetch("http://16.16.63.237/jobs/thehub", {
cache: "no-store",
});
if (!response.ok) {
throw new Error("Failed to fetch jobs");
}
revalidatePath("/");
return response.json();
}
export default async function TheHub() {
const jobs = await fetchJobs();
return (
<div className="transition ease-in-out transform -translate-y-1">
<h1 className="text-4xl my-4">The Hub</h1>
{jobs.map((job, i) => (
<JobCard key={i} job={job} />
))}
</div>
);
}