moved the hub component and functionality to own file
All checks were successful
Vercel Production Deployment / Deploy-Production (push) Successful in 1m24s
All checks were successful
Vercel Production Deployment / Deploy-Production (push) Successful in 1m24s
This commit is contained in:
parent
3579a10338
commit
4ae37ce052
45
src/app/TheHub.tsx
Normal file
45
src/app/TheHub.tsx
Normal 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} />
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
@ -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>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user