WIP for manual job creation
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import React, { useContext } from "react";
|
||||
import JobsCreateOwnerInfoComponent from "./jobs-create-owner-info.component";
|
||||
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
||||
import { QUERY_SEARCH_OWNER_BY_IDX } from "../../graphql/owners.queries";
|
||||
import { useQuery } from "react-apollo";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
|
||||
export default function JobsCreateOwnerContainer() {
|
||||
const [state] = useContext(JobCreateContext);
|
||||
const { loading, error, data } = useQuery(QUERY_SEARCH_OWNER_BY_IDX, {
|
||||
variables: { search: `%${state.owner.search}%` },
|
||||
skip: !state.vehicle.search
|
||||
});
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type='error' />;
|
||||
return (
|
||||
<JobsCreateOwnerInfoComponent
|
||||
loading={loading}
|
||||
owners={data ? data.owners : null}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user