import { notFound, redirect, RedirectType } from "next/navigation";

export default async function Home({
  params
}:{
  params: {
    slug: string
  }
}) {
  const projects = await fetch("https://projects.abtmtr.link/projects.json").then(x=>x.json());

  const curProject = projects.items.find((x:{url:string}) => x.url.includes("projects.abtmtr.link/item/" + params.slug));

  if (curProject)
    return redirect(curProject.url, RedirectType.replace);
  return notFound();
}
