Closed jacobdanovitch closed 3 years ago
Re: Graph.js#L65:89
- const defaultFirstName = 'Amanda' - const defaultLastName = 'Alexander' + let name = 'Amanda', surname = 'Alexander' const { loading: loadingPerson, data: dataPerson, error: errorPerson, } = useQuery(GET_PERSON, { variables: { filter: getFilter() } }) + if (!loadingPerson){ + { name, surName } = {...dataPerson.people[0]} + } const { loading, data, error } = useQuery(GET_FILE, { variables: { - nameInput: dataPerson - ? dataPerson.people[0] - ? dataPerson.people[0].name - : defaultFirstName - : defaultFirstName, - surnameInput: dataPerson - ? dataPerson.people[0] - ? dataPerson.people[0].surname - : defaultLastName - : defaultLastName, + nameInput: name + surnameInput: surName }, }) - if (error || errorPerson) return <p>Error</p> - if (loading || loadingPerson) return <p>Loading</p> + if (error) return <p>Error</p> + if (loading) return <p>Loading</p> let graphData = JSON.parse(data.response)
Also maybe rename GET_FILE to GET_GRAPH.
GET_FILE
GET_GRAPH
Re: Graph.js#L65:89
Also maybe rename
GET_FILE
toGET_GRAPH
.