Skip to content

Commit

Permalink
fix: add apiOptions to key field-level translation
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawntraoz committed Nov 28, 2022
1 parent 545971d commit 497de1d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/src/runtime/composables/useAsyncStoryblok.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ export const useAsyncStoryblok = async (
}
});

const hash = JSON.stringify(apiOptions);

const { data } = await useAsyncData(
url,
`${hash}-${url}`,
async () => await storyblokApiInstance.get(`cdn/stories/${url}`, apiOptions)
);
story.value = data.value.data.story;
Expand Down
6 changes: 5 additions & 1 deletion playground/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<script setup>
const story = await useAsyncStoryblok("vue", { version: "draft" });
const story = await useAsyncStoryblok("vue", {
version: "draft",
language: "en",
resolve_relations: ["popular-articles.articles"]
});
const richText = computed(() => renderRichText(story.value.content.richText));
</script>

Expand Down

0 comments on commit 497de1d

Please sign in to comment.