From 3209f8ef7e7caffdc31de514db66f9d15a945a3f Mon Sep 17 00:00:00 2001 From: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com> Date: Wed, 19 Oct 2022 14:46:45 +0800 Subject: [PATCH] [offers][fix] fix types for list some offers (#391) --- .../src/components/offers/table/OffersRow.tsx | 7 ++++--- .../src/components/offers/table/OffersTable.tsx | 15 ++------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/apps/portal/src/components/offers/table/OffersRow.tsx b/apps/portal/src/components/offers/table/OffersRow.tsx index d5039014..f7bf4dc6 100644 --- a/apps/portal/src/components/offers/table/OffersRow.tsx +++ b/apps/portal/src/components/offers/table/OffersRow.tsx @@ -1,8 +1,9 @@ import Link from 'next/link'; -import type { DashboardOffer } from '../../../types/offers'; -import { convertCurrencyToString } from '../../../utils/offers/currency'; -import { formatDate } from '../../../utils/offers/time'; +import { convertCurrencyToString } from '~/utils/offers/currency'; +import { formatDate } from '~/utils/offers/time'; + +import type { DashboardOffer } from '~/types/offers'; export type OfferTableRowProps = Readonly<{ row: DashboardOffer }>; diff --git a/apps/portal/src/components/offers/table/OffersTable.tsx b/apps/portal/src/components/offers/table/OffersTable.tsx index f9f18c83..c77bc313 100644 --- a/apps/portal/src/components/offers/table/OffersTable.tsx +++ b/apps/portal/src/components/offers/table/OffersTable.tsx @@ -9,7 +9,7 @@ import { trpc } from '~/utils/trpc'; import OffersRow from './OffersRow'; -import type { DashboardOffer, Paging } from '~/types/offers'; +import type { DashboardOffer, GetOffersResponse, Paging } from '~/types/offers'; const NUMBER_OF_OFFERS_IN_PAGE = 10; export type OffersTableProps = Readonly<{ @@ -52,18 +52,7 @@ export default function OffersTable({ }, ], { - onSuccess: (response) => { - // Const filteredData = response.data.map((res) => { - // return { - // company: res.company.name, - // date: res.monthYearReceived, - // id: res.id, - // profileId: res.profileId, - // income: res.income, - // title: res.title, - // yoe: res.totalYoe, - // }; - // }); + onSuccess: (response: GetOffersResponse) => { setOffers(response.data); setPagination(response.paging); },