diff --git a/client/src/components/header/header.component.jsx b/client/src/components/header/header.component.jsx index c1b5dce1e..5a59274c4 100644 --- a/client/src/components/header/header.component.jsx +++ b/client/src/components/header/header.component.jsx @@ -11,9 +11,11 @@ import "./header.styles.scss"; export default ({ landingHeader, navItems, selectedNavItem }) => { const apolloClient = useApolloClient(); const { t } = useTranslation(); + const handleClick = e => { apolloClient.writeData({ data: { selectedNavItem: e.key } }); }; + return ( @@ -48,17 +50,6 @@ export default ({ landingHeader, navItems, selectedNavItem }) => { - { - // navItems.map(navItem => ( - // - // - // {navItem.icontype ? : null} - // {navItem.title} - // - // - // )) - } - {!landingHeader ? null : ( diff --git a/client/src/components/owner-find-modal/owner-find-modal.container.jsx b/client/src/components/owner-find-modal/owner-find-modal.container.jsx index bd12e1559..26d9fc3be 100644 --- a/client/src/components/owner-find-modal/owner-find-modal.container.jsx +++ b/client/src/components/owner-find-modal/owner-find-modal.container.jsx @@ -21,7 +21,10 @@ export default function OwnerFindModalContainer({ const ownersList = useQuery(QUERY_SEARCH_OWNER_BY_IDX, { variables: { search: owner - ? `${owner.ownr_fn} ${owner.ownr_ln} ${owner.ownr_addr1} ${owner.ownr_city} ${owner.ownr_zip} ${owner.ownr_ea} ${owner.ownr_ph1} ${owner.ownr_ph2}` + ? `${owner.ownr_fn || ""} ${owner.ownr_ln || ""} ${owner.ownr_addr1 || + ""} ${owner.ownr_city || ""} ${owner.ownr_zip || + ""} ${owner.ownr_ea || ""} ${owner.ownr_ph1 || + ""} ${owner.ownr_ph2 || ""}` : null }, skip: !owner, diff --git a/client/src/graphql/apollo-error-handling.js b/client/src/graphql/apollo-error-handling.js index f6e72f694..7b5443ede 100644 --- a/client/src/graphql/apollo-error-handling.js +++ b/client/src/graphql/apollo-error-handling.js @@ -5,13 +5,15 @@ import { auth } from "../firebase/firebase.utils"; const errorLink = onError( ({ graphQLErrors, networkError, operation, forward }) => { - // console.log("graphQLErrors", graphQLErrors); - // console.log("networkError", networkError); - // console.log("operation", operation); - // console.log("forward", forward); + if (graphQLErrors) + graphQLErrors.forEach(({ message, locations, path }) => + console.log( + `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}` + ) + ); + if (networkError) console.log(`[Network error]: ${networkError}`); let expired = false; - if (graphQLErrors) { if (graphQLErrors[0].message.includes("JWTExpired")) { expired = true; @@ -33,12 +35,14 @@ const errorLink = onError( if (token) { console.log("Got the new token.", token); window.localStorage.setItem("token", token); - operation.setContext(({ headers = {} }) => ({ + + const oldHeaders = operation.getContext().headers; + operation.setContext({ headers: { - ...headers, + ...oldHeaders, authorization: token ? `Bearer ${token}` : "" } - })); + }); return forward(operation);