Skip to content

Commit

Permalink
Merge pull request #1 from ConstantinRoss/develop
Browse files Browse the repository at this point in the history
v.1.0.1
  • Loading branch information
c0nst4ntin authored Sep 21, 2019
2 parents 37ca63d + 7ae1291 commit b771e33
Show file tree
Hide file tree
Showing 8 changed files with 2,747 additions and 4,968 deletions.
7,672 changes: 2,720 additions & 4,952 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
},
"dependencies": {
"@bazzite/nuxt-netlify": "^0.1.1",
"lodash": "^4.17.14",
"nuxt": "^2.0.0",
"nuxt": "^2.9.2",
"nuxt-trailingslash-module": "^1.1.0",
"prismic-dom": "^2.1.0",
"prismic-javascript": "^2.0.3",
"prismic-javascript": "^2.1.1",
"prismic-vue": "git+https://github.com/prismicio/prismic-vue.git#nuxt",
"vue-component-importer": "0.0.3"
"vue-component-importer": "0.0.4"
},
"devDependencies": {
"nodemon": "^1.18.9"
"nodemon": "^1.19.2"
}
}
11 changes: 9 additions & 2 deletions pages/about.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@ import Prismic from "prismic-javascript";
import PrismicDOM from "prismic-dom";
import PrismicConfig from "~/prismic.config.js";
function initApi (req) {
return Prismic.getApi(PrismicConfig.apiEndpoint, {
accessToken: PrismicConfig.accessToken,
req: req
});
}
export default {
async asyncData({ context, error, req }) {
const api = await Prismic.getApi(PrismicConfig.apiEndpoint, { req });
const api = await initApi(req)
const document = await api.getByUID("page", "about");
if (document) {
return {
Expand Down
10 changes: 9 additions & 1 deletion pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@ import Prismic from "prismic-javascript";
import PrismicDOM from "prismic-dom";
import PrismicConfig from "~/prismic.config.js"
function initApi (req) {
return Prismic.getApi(PrismicConfig.apiEndpoint, {
accessToken: PrismicConfig.accessToken,
req: req
});
}
export default {
async asyncData({ context, error, req }) {
const api = await Prismic.getApi(PrismicConfig.apiEndpoint, {req})
const api = await initApi(req)
const document = await api.getByUID("page", "homepage");
if (document) {
return {
slices: document.data.body,
Expand Down
3 changes: 1 addition & 2 deletions plugins/componentimporter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Vue from 'vue'
import lodash from 'lodash'
import importComponents from 'vue-component-importer'

let components = require.context('@/components/slices', true, /[a-zA-Z]\w+\.(vue)$/)
importComponents(lodash, Vue, components)
importComponents(Vue, components)
6 changes: 1 addition & 5 deletions plugins/link-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ export default function (doc) {
}
return `/${doc.uid}`
}

if (doc.type === 'post') {
return `/posts/${doc.uid}`
}


return '/not-found'
}
1 change: 1 addition & 0 deletions plugins/prismic-vue.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Vue from 'vue'
import PrismicVue from 'prismic-vue'

Vue.use(PrismicVue)
3 changes: 2 additions & 1 deletion prismic.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var api = {
apiEndpoint: "https://prismic-nuxt-boilerplate.prismic.io/api/v2",
apiEndpoint: "https://your-repo-name.prismic.io/api/v2",
accessToken: "your-access-token"
}

module.exports = api;

0 comments on commit b771e33

Please sign in to comment.