implemented bill deletion + var rename

This commit is contained in:
2024-01-05 13:54:25 +01:00
parent 4ffe2de6ea
commit 86135199a9
12 changed files with 122 additions and 117 deletions

View File

@@ -1,18 +1,4 @@
import Link from 'next/link';
import { FaceFrownIcon } from '@heroicons/react/24/outline';
import { NotFoundPage } from '@/app/ui/NotFoundPage';
export default function NotFound() {
return (
<main className="flex h-full flex-col items-center justify-center gap-2">
<FaceFrownIcon className="w-10 text-gray-400" />
<h2 className="text-xl font-semibold">404 File Not Found</h2>
<p>Could not find the requested attachment.</p>
<Link
href="/"
className="mt-4 rounded-md bg-blue-500 px-4 py-2 text-sm text-white transition-colors hover:bg-blue-400"
>
Go Back
</Link>
</main>
);
}
export default () =>
<NotFoundPage title="404 File Not Found" description="Could not find the requested attachment." />;

View File

@@ -1,10 +1,10 @@
import { fetchBillById } from '@/app/lib/fetchBillById';
import { fetchBillById } from '@/app/lib/actions';
import { notFound } from 'next/navigation';
export async function GET(request: Request, { params:{ id } }: { params: { id:string } }) {
const [invoiceID, billID] = id.split('-');
const [locationID, billID] = id.split('-');
const bill = await fetchBillById(invoiceID, billID);
const bill = await fetchBillById(locationID, billID);
if(!bill?.attachment) {
notFound();