import { data, redirect } from "react-router";
import type { LoaderFunctionArgs } from "react-router";
import { getBandListBySlug } from "~/lib/db.server";

export async function loader({ params }: LoaderFunctionArgs) {
  const list = getBandListBySlug(params.slug!);
  if (!list) throw data("Not found", { status: 404 });
  return redirect(`/lists/of/${list.id}`);
}

export default function ListBySlug() {
  return null;
}
