implementiran share by link
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { fetchLocationById } from '@/app/lib/actions/locationActions';
|
||||
import { LocationDeleteForm } from '@/app/ui/LocationDeleteForm';
|
||||
import { BillDeleteForm } from '@/app/ui/BillDeleteForm';
|
||||
import { fetchBillById } from '@/app/lib/actions/billActions';
|
||||
import { Main } from '@/app/ui/Main';
|
||||
|
||||
6
app/[locale]/share/bill/[id]/not-found.tsx
Normal file
6
app/[locale]/share/bill/[id]/not-found.tsx
Normal file
@@ -0,0 +1,6 @@
|
||||
import { NotFoundPage } from '@/app/ui/NotFoundPage';
|
||||
|
||||
const BillNotFound = () =>
|
||||
<NotFoundPage title="404 Bill Not Found" description="Could not find the requested Bill." />;
|
||||
|
||||
export default BillNotFound;
|
||||
20
app/[locale]/share/bill/[id]/page.tsx
Normal file
20
app/[locale]/share/bill/[id]/page.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { fetchBillById } from '@/app/lib/actions/billActions';
|
||||
import { ViewBillCard } from '@/app/ui/ViewBillCard';
|
||||
import { Main } from '@/app/ui/Main';
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
export default async function Page({ params:{ id } }: { params: { id:string } }) {
|
||||
|
||||
const [locationID, billID] = id.split('-');
|
||||
|
||||
const [location, bill] = await fetchBillById(locationID, billID) ?? [];
|
||||
|
||||
if (!bill || !location) {
|
||||
return(notFound());
|
||||
}
|
||||
return (
|
||||
<Main>
|
||||
<ViewBillCard location={location} bill={bill} />
|
||||
</Main>
|
||||
);
|
||||
}
|
||||
13
app/[locale]/share/location/[id]/LocationViewPage.tsx
Normal file
13
app/[locale]/share/location/[id]/LocationViewPage.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { ViewLocationCard } from '@/app/ui/ViewLocationCard';
|
||||
import { fetchLocationById } from '@/app/lib/actions/locationActions';
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
export default async function LocationViewPage({ locationId }: { locationId:string }) {
|
||||
const location = await fetchLocationById(locationId);
|
||||
|
||||
if (!location) {
|
||||
return(notFound());
|
||||
}
|
||||
|
||||
return (<ViewLocationCard location={location} />);
|
||||
}
|
||||
15
app/[locale]/share/location/[id]/page.tsx
Normal file
15
app/[locale]/share/location/[id]/page.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Suspense } from 'react';
|
||||
import LocationViewPage from './LocationViewPage';
|
||||
import { Main } from '@/app/ui/Main';
|
||||
import { LocationEditFormSkeleton } from '@/app/ui/LocationEditForm';
|
||||
|
||||
export default async function Page({ params:{ id } }: { params: { id:string } }) {
|
||||
|
||||
return (
|
||||
<Main>
|
||||
<Suspense fallback={<LocationEditFormSkeleton />}>
|
||||
<LocationViewPage locationId={id} />
|
||||
</Suspense>
|
||||
</Main>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user