magento / pwa-studio

🛠Development tools to build, optimize and deploy Progressive Web Applications for Magento 2.
https://developer.adobe.com/commerce/pwa-studio/
Open Software License 3.0
1.07k stars 683 forks source link

How to parse JSON to index.html? #4356

Open nickcarterney opened 4 days ago

nickcarterney commented 4 days ago

I can get data from GraphQL in upward..yml , but It's writing

===> Hellow ===> {{cmsPageResult > json}}

I want to print the JSON data to {{messageContent}}

veniaAppShell:
    resolver: inline
    inline:
        status:
            resolver: inline
            inline: 200
        headers:
            resolver: inline
            inline:
                content-type:
                    inline: text/html
                cache-control:
                    inline: s-maxage=60
        body:
            resolver: template
            engine: mustache
            provide:
                pageType: veniaPageType.data
                pageTypeNonce: veniaPageTypeNonce.nonce
                webpackChunks: veniaWebpackChunks.scripts
                **textHellow:
                    resolver: inline
                    inline: "Hellow"
                messageContent: 
                  resolver: inline
                  inline: '{{cmsPageResult > json}}' # ???? I want cmsPageResult to show as JSON in index.html**
            template:
                resolver: file
                file:
                    resolver: inline
                    inline: './index.html'

cmsPageResult:
  url: 
    resolver: inline
    inline: "DOMAIN/graphql"
  query:
    resolver: inline
    inline: |
      query {
        storeConfig {
          header_logo_src
          logo_alt
          logo_height
          logo_width
          store_code
        }
      }

<!DOCTYPE html>
<html>
    <head>

    </head>
    <body class="bg-body text-base text-colorDefault overflow-x-hidden">
        **===> {{textHellow}}
        ===> {{messageContent}}**
    </body>
</html>
m2-assistant[bot] commented 4 days ago

Hi @nickcarterney. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information. Add a comment to assign the issue: @magento I am working on this


Join Magento Community Engineering Slack and ask your questions in #github channel.