Skip to content

Commit

Permalink
fix: get GQL response using lodash's "get" function
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed May 21, 2019
1 parent d108be7 commit adf21d5
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -5,6 +5,7 @@ import { Query } from "react-apollo";
import { withCms } from "webiny-app-cms/context";
import { loadPages } from "./graphql";
import { getPlugins } from "webiny-plugins";
import { get } from "lodash";

const PagesList = pure(({ data = {}, cms: { theme } }: Object = {}) => {
const { component, ...vars } = data;
Expand Down Expand Up @@ -43,7 +44,7 @@ const PagesList = pure(({ data = {}, cms: { theme } }: Object = {}) => {
return "Loading...";
}

const pages = data.cms.listPublishedPages;
const pages = get(data, "cms.listPublishedPages");

if (!pages || !pages.data.length) {
return "No pages match the criteria.";
Expand Down

0 comments on commit adf21d5

Please sign in to comment.