You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently updated a project form oazapfts v4 to v6 and since then every value returned from my API has te correct typescript types from my api, but the actual values are strings.
I've been able to work around it doing this dirty hack:
const response = await createBusinessAndGetBucketUrlMutation.mutateAsync({
organizationId,
body: { ...data, fileNames: data.files.map((file) => file.name) },
});
// response has the correct Tpescript type, but throws a runtime error since its actually a string that can't be destructured as an object
const { fileUrls, business } = JSON.parse(
response.toString(),
) as typeof response; // typeof response has the correct type
Something must be wrong with the internal oazapfts.fetchJson function.
I ran into this issue too, had a look at the @oazapfts/runtime src (looking for JSON.parse), and you can see it is searching the headers for "json" in the Content-Type before choosing to JSON.parse it (or not). When I looked at my server responses more carefully I noticed "Content-Type": "text/plain", so changing my headers on the serverside to return "Content-Type": "application/json" fixed this for me - if that's helpful.
I recently updated a project form oazapfts v4 to v6 and since then every value returned from my API has te correct typescript types from my api, but the actual values are strings.
I've been able to work around it doing this dirty hack:
Something must be wrong with the internal
oazapfts.fetchJson
function.This is the generated code from my optimistc api:
``
The text was updated successfully, but these errors were encountered: