moved the hub component and functionality to own file
All checks were successful
Vercel Production Deployment / Deploy-Production (push) Successful in 1m24s

This commit is contained in:
christian 2024-06-10 00:20:09 +02:00
parent 3579a10338
commit 4ae37ce052
2 changed files with 49 additions and 40 deletions

45
src/app/TheHub.tsx Normal file
View File

@ -0,0 +1,45 @@
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://51.20.250.24/jobs", {
cache: "no-cache",
});
if (!response.ok) {
throw new Error("Failed to fetch jobs");
}
revalidatePath("/");
return response.json();
}
export default async function TheHub() {
const jobs = await fetchJobs();
return (
<>
<h1 className="text-4xl my-4">The Hub</h1>
{jobs.map((job, i) => (
<JobCard key={i} job={job} />
))}
</>
);
}

View File

@ -1,46 +1,10 @@
import { revalidatePath } from "next/cache"; import TheHub from "./TheHub";
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://51.20.250.24/jobs", {
cache: "no-cache",
});
if (!response.ok) {
throw new Error("Failed to fetch jobs");
}
revalidatePath("/");
return response.json();
}
export default async function Home() { export default async function Home() {
const jobs = await fetchJobs();
return ( return (
<main> <main className="container">
<div className="container"> <div>
<h1 className="text-4xl my-4">The Hub</h1> <TheHub />
{jobs.map((job, i) => (
<JobCard key={i} job={job} />
))}
</div> </div>
</main> </main>
); );