refactoring: fixing typescript

This commit is contained in:
2024-01-09 16:41:59 +01:00
parent 53a266df44
commit 102edff52f
10 changed files with 23 additions and 23 deletions

View File

@@ -1,4 +1,6 @@
import { NotFoundPage } from '@/app/ui/NotFoundPage';
export default () =>
<NotFoundPage title="404 File Not Found" description="Could not find the requested attachment." />;
const AttachmentNotFound = () =>
<NotFoundPage title="404 File Not Found" description="Could not find the requested attachment." />;
export default AttachmentNotFound;

View File

@@ -1,4 +1,6 @@
import { NotFoundPage } from '@/app/ui/NotFoundPage';
export default () =>
<NotFoundPage title="404 Bill Not Found" description="Could not find the requested Bill." />;
const BillNotFound = () =>
<NotFoundPage title="404 Bill Not Found" description="Could not find the requested Bill." />;
export default BillNotFound;

View File

@@ -1,4 +1,6 @@
import { NotFoundPage } from '@/app/ui/NotFoundPage';
export default () =>
<NotFoundPage title="404 Bill Not Found" description="Could not find the requested Bill." />;
const BillNotFound = () =>
<NotFoundPage title="404 Bill Not Found" description="Could not find the requested Bill." />;
export default BillNotFound;

View File

@@ -1,8 +1,5 @@
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';
export default async function Page({ params:{ id } }: { params: { id:string } }) {

View File

@@ -110,12 +110,10 @@ const serializeAttachment = async (billAttachment: File | null) => {
* @param formData form data
* @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 x = formData.get('payedAmount');
const validatedFields = UpdateBill.safeParse({
billName: formData.get('billName'),
billNotes: formData.get('billNotes'),

View File

@@ -33,7 +33,7 @@ const UpdateLocation = FormSchema.omit({ _id: true });
* @param formData form data
* @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({
locationName: formData.get('locationName'),

View File

@@ -1,4 +1,6 @@
import { NotFoundPage } from '@/app/ui/NotFoundPage';
export default () =>
<NotFoundPage title="404 Billing Location Not Found" description="Could not find the requested Billing Location." />;
const BillingLocationNotFound = () =>
<NotFoundPage title="404 Billing Location Not Found" description="Could not find the requested Billing Location." />;
export default BillingLocationNotFound;

View File

@@ -1,4 +1,6 @@
import { NotFoundPage } from '@/app/ui/NotFoundPage';
export default () =>
<NotFoundPage title="404 Location Not Found" description="Could not find the requested Location." />;
const BillingLocationNotFound = () =>
<NotFoundPage title="404 Location Not Found" description="Could not find the requested Location." />;
export default BillingLocationNotFound;

View File

@@ -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 { LocationEditForm } from '@/app/ui/LocationEditForm';
import { fetchLocationById } from '@/app/lib/actions/locationActions';

View File

@@ -18,7 +18,7 @@ const getNextYearMonth = (yearMonth:YearMonth) => {
} as YearMonth);
}
export const Page = async () => {
const Page = async () => {
const locations = await fetchAllLocations();
const availableYears = await fetchAvailableYears();