pass additional props to wrapper

This commit is contained in:
Winzlieb - 2022-03-14 14:22:03 +01:00
parent 36d752610a
commit 654e1da0c2
2 changed files with 10 additions and 7 deletions

View File

@ -30,7 +30,7 @@ import {transformValue} from "../util/tableValueMapper";
global.moment = moment global.moment = moment
type Data = GetOffersQuery["get_offers"]; type Data = GetOffersQuery["get_offers"];
type HostOfferLookupTableProps = { export type HostOfferLookupTableProps = {
data_ro?: GetOffersQuery, data_ro?: GetOffersQuery,
data_rw?: GetRwQuery, // TODO data_rw?: GetRwQuery, // TODO
refetch_rw: any, refetch_rw: any,

View File

@ -1,13 +1,13 @@
import React from 'react' import React from 'react'
import { useGetOffersQuery, useGetRwQuery } from "../../codegen/generates" import { useGetOffersQuery, useGetRwQuery } from "../../codegen/generates"
import HostOfferLookupTable from "./HostOfferLookupTable" import HostOfferLookupTable, {HostOfferLookupTableProps} from "./HostOfferLookupTable"
import { Box } from "@mui/material" import { Box } from "@mui/material"
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { Login, useAuthStore } from '../Login' import { Login, useAuthStore } from '../Login'
type HostLookupWrapperProps = Record<string, never> type HostOfferLookupWrapperProps = Partial<HostOfferLookupTableProps>
const HostOfferLookupWrapper = ({}: HostLookupWrapperProps) => { const HostOfferLookupWrapper = (props: HostOfferLookupWrapperProps) => {
const { t } = useTranslation() const { t } = useTranslation()
const auth = useAuthStore() const auth = useAuthStore()
@ -31,9 +31,12 @@ const HostOfferLookupWrapper = ({}: HostLookupWrapperProps) => {
<Login/> <Login/>
{queryResult_ro.data && <div {queryResult_ro.data && <div
style={{flex: '1 1', height: '100%'}}> style={{flex: '1 1', height: '100%'}}>
<HostOfferLookupTable data_ro={queryResult_ro.data} <HostOfferLookupTable
data_rw={queryResult_rw.data} {...props}
refetch_rw={queryResult_rw.refetch}/> data_ro={queryResult_ro.data}
data_rw={queryResult_rw.data}
refetch_rw={queryResult_rw.refetch}
/>
</div>} </div>}
</Box> </Box>
</> </>