I want to make a query based on job_id: ID! but seem like something I am doing wrong and I want to understand what.
So here I am taking the job id.
render() {
const { job } = this.props.navigation.state.params;
const job_id = job._id;
........
}
So now I want to use that job_id for my query here
const GET_APPLICATIONS = gql`
query getJobApplicationsForThisJob($job_id: ID!) {
getJobApplicationsForThisJob(job_id: $job_id) {
_id
}
}
`;
const DELETE_JOB = gql`
mutation deteleJob($_id: ID!) {
deleteJob(_id: $_id) {
message
}
}
`;
const mutationConfig = {
props: ({ mutate, ownProps }) => ({
deleteJob: (_id) => mutate({ variables: { _id } }),
...ownProps,
})
}
export default compose(
withApollo,
graphql(GET_APPLICATIONS, { name: "getApplications" }),
graphql(DELETE_JOB, mutationConfig)
)(JobDetails);
But I end up with the following error
Invariant Violation: The operation 'getJobApplicationsForThisJob' wrapping 'JobDetails' is expecting variable 'job_id' but it was not found in the props passed to 'Apollo(JobDetails)'
Any idea?