provide first query components
This commit is contained in:
parent
1a9088e3e9
commit
e2b6aaf5a0
|
@ -0,0 +1,14 @@
|
|||
import React from 'react'
|
||||
import {GetOffersQuery} from "../../codegen/generates";
|
||||
|
||||
type HostOfferLookupTableProps = {
|
||||
data: GetOffersQuery
|
||||
}
|
||||
|
||||
const HostOfferLookupTable = ({ data }: HostOfferLookupTableProps) => {
|
||||
return <>
|
||||
{ data.get_offers?.map(offer => (<div>{offer.contact_name_full}</div>)) }
|
||||
</>
|
||||
}
|
||||
|
||||
export default HostOfferLookupTable
|
|
@ -0,0 +1,17 @@
|
|||
import React from 'react'
|
||||
import {Auth, useGetOffersQuery} from "../../codegen/generates";
|
||||
import testAuth from '../util/testAuth.json'
|
||||
import HostOfferLookupTable from "./HostOfferLookupTable";
|
||||
|
||||
type HostLookupWrapperProps = Record<string, never>
|
||||
|
||||
const HostOfferLookupWrapper = ({}: HostLookupWrapperProps) => {
|
||||
const {data, isFetching} = useGetOffersQuery({auth: testAuth as Auth}, {staleTime: 60 * 1000})
|
||||
if (isFetching) {
|
||||
return "loading…"
|
||||
} else if (data?.get_offers) {
|
||||
return (<HostOfferLookupTable data={data}/>)
|
||||
}
|
||||
}
|
||||
|
||||
export default HostOfferLookupWrapper
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"mail": "crewing@example-ngo.com",
|
||||
"password": "Vr(+cFtUG=rsj2:/]*uR"
|
||||
}
|
|
@ -1,8 +1,11 @@
|
|||
import '../styles/globals.css'
|
||||
import type { AppProps } from 'next/app'
|
||||
import MyQueryClientProvider from "../components/QueryClientProvider";
|
||||
|
||||
function MyApp({ Component, pageProps }: AppProps) {
|
||||
return <Component {...pageProps} />
|
||||
return <MyQueryClientProvider>
|
||||
<Component {...pageProps} />
|
||||
</MyQueryClientProvider>
|
||||
}
|
||||
|
||||
export default MyApp
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import type { NextPage } from 'next'
|
||||
import Head from 'next/head'
|
||||
import HostOfferLookupWrapper from '../components/ngo/HostOfferLookupWrapper'
|
||||
import styles from '../styles/Home.module.css'
|
||||
|
||||
const Home: NextPage = () => {
|
||||
|
@ -11,7 +12,7 @@ const Home: NextPage = () => {
|
|||
</Head>
|
||||
|
||||
<main className={styles.main}>
|
||||
Miau
|
||||
<HostOfferLookupWrapper />
|
||||
</main>
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue