Skip to content

Commit bf637c8

Browse files
authored
Merge pull request #7 from contentstack/feat/ECO-184_added_json_rte
fix:updated version [ECO-184]
2 parents 47ebbaa + f3d2bf2 commit bf637c8

File tree

12 files changed

+224
-181
lines changed

12 files changed

+224
-181
lines changed

.env

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
VUE_APP_CONTENTSTACK_API_KEY =your_stack_api_key
2-
VUE_APP_CONTENTSTACK_DELIVERY_TOKEN = your_stack_delivery_token
3-
VUE_APP_CONTENTSTACK_ENVIRONMENT = delivery_token_env
1+
VUE_APP_CONTENTSTACK_API_KEY =YOUR_API_KEY
2+
VUE_APP_CONTENTSTACK_DELIVERY_TOKEN = YOUR_DELIVERY_TOKEN
3+
VUE_APP_CONTENTSTACK_ENVIRONMENT = YOUR_PUBLISHING_ENVIRONMENT
44
# optional EU region (default region is NA/US) when its kept empty
55
# VUE_APP_CONTENTSTACK_REGION =

package-lock.json

Lines changed: 96 additions & 94 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "contentstack-vuejs-starter-app",
3-
"version": "1.1.1",
3+
"version": "1.2.0",
44
"description": "A simple starter app build using VueJS and Contentstack",
55
"author": "Contentstack",
66
"license": "MIT",
@@ -12,7 +12,8 @@
1212
},
1313
"dependencies": {
1414
"@alenaksu/json-viewer": "^0.3.4",
15-
"contentstack": "^3.12.2",
15+
"@contentstack/utils": "^1.1.0",
16+
"contentstack": "^3.14.0",
1617
"core-js": "^3.6.5",
1718
"moment": "^2.29.1",
1819
"register-service-worker": "^1.7.1",

src/components/BlogSection.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
/>
2323
<div class="featured-content">
2424
<h3>{{ index.title }}</h3>
25-
<p v-html="index.body.slice(0, 255)" />
25+
<p
26+
v-if="typeof index.body === 'string'"
27+
v-html="index.body.slice(0, 255)"
28+
/>
2629
<p>
2730
<router-link class="blogpost-readmore" :to="index.url">
2831
Read More -->

src/components/Footer.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
</div>
4242
</div>
4343
<div class="copyright">
44-
<p v-html="data.copyright" />
44+
<p v-if="typeof data.copyright === 'string'" v-html="data.copyright" />
4545
</div>
4646
</footer>
4747
</template>
@@ -61,7 +61,10 @@ export default {
6161
},
6262
methods: {
6363
async getData() {
64-
let response = await Stack.getEntries('footer');
64+
let response = await Stack.getEntries({
65+
contentTypeUid: 'footer',
66+
jsonRtePath: ['copyright']
67+
});
6568
this.data = response[0];
6669
this.$store.dispatch('setFooter', response[0]);
6770
}

src/components/Header.vue

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<template>
22
<header v-if="data" class="header">
3-
<div class="note-div">
4-
<span v-html="data.notification_bar.announcement_text" />
3+
<div class="note-div" v-if="data.notification_bar.show_announcement">
4+
<span
5+
v-if="typeof data.notification_bar.announcement_text === 'string'"
6+
v-html="data.notification_bar.announcement_text"
7+
/>
58
<span
69
class="devtools"
710
data-bs-toggle="modal"
@@ -42,7 +45,10 @@
4245
:key="navItems.title"
4346
class="nav-li"
4447
>
45-
<router-link :to="navItems.page_reference[0].url">
48+
<router-link
49+
:to="navItems.page_reference[0].url"
50+
active-class="active"
51+
>
4652
{{ navItems.page_reference[0].title }}
4753
</router-link>
4854
</li>
@@ -67,10 +73,11 @@ export default {
6773
},
6874
methods: {
6975
async getData() {
70-
let response = await Stack.getEntries(
71-
'header',
72-
`navigation_menu.page_reference`
73-
);
76+
let response = await Stack.getEntries({
77+
contentTypeUid: 'header',
78+
referenceFieldPath: `navigation_menu.page_reference`,
79+
jsonRtePath: ['notification_bar.announcement_text']
80+
});
7481
this.data = response[0];
7582
this.$store.dispatch('setHeader', response[0]);
7683
}

0 commit comments

Comments
 (0)