Hello,
I've been working on a svelte frontend that was utilizing the javascript Prismic client to get data from Prismic. It was working well, however we realized that we need to utilize a proxy to handle requests from sending data based on authentication. Long story short, I've got an express server getting requests from my svelte frontend and am formatting requests to the node Prismic client I added to the server.
The issue is the response that I am getting is formatted differently than when querying directly from the front-end.
For example, when using getByUid directly from the frontend (js client) the request would look like this:
data:
article_main_title: Array(1)
0: {type: 'heading1', text: 'Statement extracts', spans: Array(0)}
length: 1
author: {link_type: 'Document'}
body: (10) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
comments: [{…}]
When using getByUid from the proxy (node client) the request looks like this
data:
document:
article_main_title:
type: "StructuredText"
value: [{…}]
body: {type: 'SliceZone', value: Array(10)}
comments: {type: 'Group', value: Array(1)}
This is making the exact same query just from two different places.
Notice that there is a difference in the formatting. In particular, each property in the node version has a 'type' and 'value' property, while in the javascript version, the property just has the value without an internal 'value' property.
Is this expected behavior? Did I perhaps not set up the node client properly or am missing something?
Thanks