refactoring: fixing typescript
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
import { NotFoundPage } from '@/app/ui/NotFoundPage';
|
import { NotFoundPage } from '@/app/ui/NotFoundPage';
|
||||||
|
|
||||||
export default () =>
|
const AttachmentNotFound = () =>
|
||||||
<NotFoundPage title="404 File Not Found" description="Could not find the requested attachment." />;
|
<NotFoundPage title="404 File Not Found" description="Could not find the requested attachment." />;
|
||||||
|
|
||||||
|
export default AttachmentNotFound;
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
import { NotFoundPage } from '@/app/ui/NotFoundPage';
|
import { NotFoundPage } from '@/app/ui/NotFoundPage';
|
||||||
|
|
||||||
export default () =>
|
const BillNotFound = () =>
|
||||||
<NotFoundPage title="404 Bill Not Found" description="Could not find the requested Bill." />;
|
<NotFoundPage title="404 Bill Not Found" description="Could not find the requested Bill." />;
|
||||||
|
|
||||||
|
export default BillNotFound;
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
import { NotFoundPage } from '@/app/ui/NotFoundPage';
|
import { NotFoundPage } from '@/app/ui/NotFoundPage';
|
||||||
|
|
||||||
export default () =>
|
const BillNotFound = () =>
|
||||||
<NotFoundPage title="404 Bill Not Found" description="Could not find the requested Bill." />;
|
<NotFoundPage title="404 Bill Not Found" description="Could not find the requested Bill." />;
|
||||||
|
|
||||||
|
export default BillNotFound;
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
import { BillingLocation, Bill } from '@/app/lib/db-types';
|
|
||||||
import { fetchBillById } from '@/app/lib/actions/billActions';
|
import { fetchBillById } from '@/app/lib/actions/billActions';
|
||||||
import clientPromise from '@/app/lib/mongodb';
|
|
||||||
import { BillEditForm } from '@/app/ui/BillEditForm';
|
import { BillEditForm } from '@/app/ui/BillEditForm';
|
||||||
import { ObjectId } from 'mongodb';
|
|
||||||
import { notFound } from 'next/navigation';
|
import { notFound } from 'next/navigation';
|
||||||
|
|
||||||
export default async function Page({ params:{ id } }: { params: { id:string } }) {
|
export default async function Page({ params:{ id } }: { params: { id:string } }) {
|
||||||
|
|||||||
@@ -110,12 +110,10 @@ const serializeAttachment = async (billAttachment: File | null) => {
|
|||||||
* @param formData form data
|
* @param formData form data
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationId: string, billId?:string, prevState:State, formData: FormData) => {
|
export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationId: string, billId:string|undefined, prevState:State, formData: FormData) => {
|
||||||
|
|
||||||
const { id: userId } = user;
|
const { id: userId } = user;
|
||||||
|
|
||||||
const x = formData.get('payedAmount');
|
|
||||||
|
|
||||||
const validatedFields = UpdateBill.safeParse({
|
const validatedFields = UpdateBill.safeParse({
|
||||||
billName: formData.get('billName'),
|
billName: formData.get('billName'),
|
||||||
billNotes: formData.get('billNotes'),
|
billNotes: formData.get('billNotes'),
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ const UpdateLocation = FormSchema.omit({ _id: true });
|
|||||||
* @param formData form data
|
* @param formData form data
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locationId?: string, yearMonth?: YearMonth, prevState:State, formData: FormData) => {
|
export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locationId: string | undefined, yearMonth: YearMonth | undefined, prevState:State, formData: FormData) => {
|
||||||
|
|
||||||
const validatedFields = UpdateLocation.safeParse({
|
const validatedFields = UpdateLocation.safeParse({
|
||||||
locationName: formData.get('locationName'),
|
locationName: formData.get('locationName'),
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { NotFoundPage } from '@/app/ui/NotFoundPage';
|
import { NotFoundPage } from '@/app/ui/NotFoundPage';
|
||||||
|
|
||||||
export default () =>
|
const BillingLocationNotFound = () =>
|
||||||
<NotFoundPage title="404 Billing Location Not Found" description="Could not find the requested Billing Location." />;
|
<NotFoundPage title="404 Billing Location Not Found" description="Could not find the requested Billing Location." />;
|
||||||
|
|
||||||
|
export default BillingLocationNotFound;
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
import { NotFoundPage } from '@/app/ui/NotFoundPage';
|
import { NotFoundPage } from '@/app/ui/NotFoundPage';
|
||||||
|
|
||||||
export default () =>
|
const BillingLocationNotFound = () =>
|
||||||
<NotFoundPage title="404 Location Not Found" description="Could not find the requested Location." />;
|
<NotFoundPage title="404 Location Not Found" description="Could not find the requested Location." />;
|
||||||
|
|
||||||
|
export default BillingLocationNotFound;
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
import { BillingLocation, Bill } from '@/app/lib/db-types';
|
|
||||||
import { fetchBillById } from '@/app/lib/actions/billActions';
|
|
||||||
import clientPromise from '@/app/lib/mongodb';
|
|
||||||
import { BillEditForm } from '@/app/ui/BillEditForm';
|
|
||||||
import { ObjectId } from 'mongodb';
|
|
||||||
import { notFound } from 'next/navigation';
|
import { notFound } from 'next/navigation';
|
||||||
import { LocationEditForm } from '@/app/ui/LocationEditForm';
|
import { LocationEditForm } from '@/app/ui/LocationEditForm';
|
||||||
import { fetchLocationById } from '@/app/lib/actions/locationActions';
|
import { fetchLocationById } from '@/app/lib/actions/locationActions';
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const getNextYearMonth = (yearMonth:YearMonth) => {
|
|||||||
} as YearMonth);
|
} as YearMonth);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Page = async () => {
|
const Page = async () => {
|
||||||
|
|
||||||
const locations = await fetchAllLocations();
|
const locations = await fetchAllLocations();
|
||||||
const availableYears = await fetchAvailableYears();
|
const availableYears = await fetchAvailableYears();
|
||||||
|
|||||||
Reference in New Issue
Block a user