Skip to content

Commit

Permalink
fix(default-theme): product details associations problem
Browse files Browse the repository at this point in the history
  • Loading branch information
mkucmus committed Aug 12, 2020
1 parent def73d8 commit 11cb80b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
12 changes: 11 additions & 1 deletion packages/composables/__tests__/useCms.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ describe("Composables - useCms", () => {
{
configuration: {
associations: [
{ name: "productReviews" },
{ name: "media" },
{ associations: [{ name: "group" }], name: "options" },
],
includes: getIncludesForEntity("useCms"),
Expand All @@ -102,6 +104,8 @@ describe("Composables - useCms", () => {
{
configuration: {
associations: [
{ name: "productReviews" },
{ name: "media" },
{ associations: [{ name: "group" }], name: "options" },
],
includes: getIncludesForEntity("useCms"),
Expand All @@ -122,6 +126,8 @@ describe("Composables - useCms", () => {
{
configuration: {
associations: [
{ name: "productReviews" },
{ name: "media" },
{ associations: [{ name: "group" }], name: "options" },
],
includes: getIncludesForEntity("useCms"),
Expand All @@ -144,6 +150,8 @@ describe("Composables - useCms", () => {
{
configuration: {
associations: [
{ name: "productReviews" },
{ name: "media" },
{ associations: [{ name: "group" }], name: "options" },
],
includes: getIncludesForEntity("useCms"),
Expand All @@ -166,7 +174,9 @@ describe("Composables - useCms", () => {
{
configuration: {
associations: [
{ associations: [{ name: "group" }], name: "options" },
{ name: "productReviews" },
{ name: "media" },
{ name: "options", associations: [{ name: "group" }] },
],
includes: { product: ["name"] },
},
Expand Down
11 changes: 10 additions & 1 deletion packages/composables/src/api-params.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"useCms": {
"associations": [{
"associations": [
{
"name": "productReviews"
},
{
"name": "media"
},
{
"name": "options",
"associations": [
{
Expand Down Expand Up @@ -41,6 +48,8 @@
"config"
],
"product": [
"media",
"productReviews",
"name",
"ratingAverage",
"calculatedPrice",
Expand Down
9 changes: 0 additions & 9 deletions packages/default-theme/components/views/ProductView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,6 @@ export default {
: this.page.product
},
},
async mounted() {
try {
const { loadAssociations, product } = useProduct(this, this.page.product)
this.productWithAssociations = product
await loadAssociations()
} catch (e) {
console.error("ProductView:mounted:loadAssociations", e)
}
},
}
</script>
<style lang="scss" scoped>
Expand Down

0 comments on commit 11cb80b

Please sign in to comment.