From d23f300419fbe0edf6bdf563c678f12d95131a0c Mon Sep 17 00:00:00 2001 From: Luis Fernando Moron Date: Thu, 21 Mar 2024 12:12:44 -0400 Subject: [PATCH] test: create lease function splited --- lib/useCases/LeaseContractUseCases.tsx | 4 ++-- pages/main/index.tsx | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/useCases/LeaseContractUseCases.tsx b/lib/useCases/LeaseContractUseCases.tsx index 2f32e61..0655439 100644 --- a/lib/useCases/LeaseContractUseCases.tsx +++ b/lib/useCases/LeaseContractUseCases.tsx @@ -52,8 +52,8 @@ export default class LeaseContractUseCases extends AbstractUseCases< async generateTasks( unknownObj: Record ): Promise { - const { id } = unknownObj; - let lease = await this.findById(id as string, []); + const { _id } = unknownObj; + let lease = await this.findById(_id as string, []); const generateEvents = false; lease = await this.generateMonthlyRecurringTasks(lease, generateEvents); diff --git a/pages/main/index.tsx b/pages/main/index.tsx index d3979d4..96d9e61 100644 --- a/pages/main/index.tsx +++ b/pages/main/index.tsx @@ -47,18 +47,16 @@ const Main: NextPage = (props: NewPropertyProps) => { const router = useRouter(); useEffect(() => { - /* async function onSucessTasks(response: Response) { + async function onSucessTasks(response: Response) { const data = await response.json(); const url = data.url as string; router.push(url || '/'); - } */ + } async function onSuccessCreate(response: Response) { const data = await response.json(); - console.log('loggin!!'); /* eslint-disable-line*/ - console.log(data); /* eslint-disable-line*/ - // const url = data.url as string; - // router.push(url || '/'); + const { createTasksCallback } = leaseCalls; + await createTasksCallback(data, onSucessTasks); } async function create() {