@nuxtjs/strapi
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -5,2 +5,14 @@ # Changelog | ||
### [0.1.2](https://github.com/nuxt-community/strapi-module/compare/v0.1.1...v0.1.2) (2020-07-16) | ||
### Features | ||
* use runtimeConfig to avoid building when changing Strapi URL ([4442467](https://github.com/nuxt-community/strapi-module/commit/4442467b294ee7352dccf3131682e20b0f89f706)) | ||
### Bug Fixes | ||
* update test with new example ([404fdca](https://github.com/nuxt-community/strapi-module/commit/404fdca6f880c685d31c84a20838b5fd5e05b1e0)) | ||
### [0.1.1](https://github.com/nuxt-company/strapi-module/compare/v0.1.0...v0.1.1) (2020-07-08) | ||
@@ -7,0 +19,0 @@ |
@@ -16,3 +16,4 @@ const { resolve } = require('path') | ||
this.options.publicRuntimeConfig = this.options.publicRuntimeConfig || {} | ||
this.options.publicRuntimeConfig.strapiUrl = options.url | ||
this.options.publicRuntimeConfig.strapi = this.options.publicRuntimeConfig.strapi || {} | ||
this.options.publicRuntimeConfig.strapi.url = options.url | ||
@@ -19,0 +20,0 @@ this.addPlugin({ |
@@ -11,2 +11,4 @@ import Vue from 'vue' | ||
ctx.$config = ctx.$config || {} // fallback for Nuxt < 2.13 | ||
const runtimeConfig = ctx.$config.strapi || {} | ||
this.state = Vue.observable({ user: null }) | ||
@@ -16,3 +18,3 @@ | ||
this.$http = ctx.$http.create({}) | ||
this.$http.setBaseURL('<%= options.url %>') | ||
this.$http.setBaseURL(runtimeConfig.url || '<%= options.url %>') | ||
this.$http.onError((err) => { | ||
@@ -144,28 +146,28 @@ const { response: { data: { message: msg } } } = err | ||
<%= JSON.stringify(options.entities) %>.forEach((entity) => { | ||
Object.defineProperty(Strapi.prototype, `$${entity}`, { | ||
get: function () { | ||
const that = this | ||
return { | ||
find: function (...args) { | ||
return that.find(entity, ...args) | ||
}, | ||
findOne: function (...args) { | ||
return that.findOne(entity, ...args) | ||
}, | ||
count: function (...args) { | ||
return that.count(entity, ...args) | ||
}, | ||
create: function (...args) { | ||
return that.create(entity, ...args) | ||
}, | ||
update: function (...args) { | ||
return that.update(entity, ...args) | ||
}, | ||
delete: function (...args) { | ||
return that.delete(entity, ...args) | ||
Object.defineProperty(Strapi.prototype, `$${entity}`, { | ||
get () { | ||
const that = this | ||
return { | ||
find (...args) { | ||
return that.find(entity, ...args) | ||
}, | ||
findOne (...args) { | ||
return that.findOne(entity, ...args) | ||
}, | ||
count (...args) { | ||
return that.count(entity, ...args) | ||
}, | ||
create (...args) { | ||
return that.create(entity, ...args) | ||
}, | ||
update (...args) { | ||
return that.update(entity, ...args) | ||
}, | ||
delete (...args) { | ||
return that.delete(entity, ...args) | ||
} | ||
} | ||
} | ||
} | ||
}) | ||
}) | ||
}) | ||
@@ -172,0 +174,0 @@ const strapi = new Strapi(ctx) |
{ | ||
"name": "@nuxtjs/strapi", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "", | ||
@@ -23,3 +23,3 @@ "repository": "", | ||
"dependencies": { | ||
"@nuxt/http": "^0.5.7", | ||
"@nuxt/http": "^0.5.9", | ||
"cookie-universal-nuxt": "^2.1.4", | ||
@@ -26,0 +26,0 @@ "defu": "^2.0.4", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10905
183
1
Updated@nuxt/http@^0.5.9