Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nuxtjs/strapi

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuxtjs/strapi - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

12

CHANGELOG.md

@@ -5,2 +5,14 @@ # Changelog

### [0.1.5](https://github.com/nuxt-community/strapi-module/compare/v0.1.4...v0.1.5) (2020-08-21)
### Features
* handle single-type entity type ([#35](https://github.com/nuxt-community/strapi-module/issues/35)) ([04b440b](https://github.com/nuxt-community/strapi-module/commit/04b440b105ecb63932d98d5e3a64fd265919353b))
### Bug Fixes
* **plugin:** reactivity on hydatation ([#34](https://github.com/nuxt-community/strapi-module/issues/34)) ([b7e764f](https://github.com/nuxt-community/strapi-module/commit/b7e764f50f70ad68012fcc4a6f8d769f6ae27b67))
### [0.1.4](https://github.com/nuxt-community/strapi-module/compare/v0.1.3...v0.1.4) (2020-08-18)

@@ -7,0 +19,0 @@

58

lib/plugin.js

@@ -17,3 +17,3 @@ import Vue from 'vue'

this.$http = ctx.$http.create({})
this.$http.setToken(this.getToken (), 'Bearer')
this.$http.setToken(this.getToken(), 'Bearer')
this.$http.setBaseURL(runtimeConfig.url || '<%= options.url %>')

@@ -122,10 +122,17 @@ this.$http.onError((err) => {

update (entity, id, data) {
return this.$http.$put(`/${entity}/${id}`, data)
if (typeof id === 'object') {
data = id
id = undefined
}
const path = [entity, id].filter(Boolean).join('/')
return this.$http.$put(`/${path}`, data)
}
delete (entity, id) {
return this.$http.$delete(`/${entity}/${id}`)
const path = [entity, id].filter(Boolean).join('/')
return this.$http.$delete(`/${path}`)
}
async graphql(data) {
async graphql (data) {
const request = await this.$http.$post(`/graphql`, data)

@@ -152,13 +159,33 @@ return request.data;

<%= JSON.stringify(options.entities) %>.forEach((entity) => {
const key = `$${entity}`
if (Strapi.prototype.hasOwnProperty(key)) {
return
}
Object.defineProperty(Strapi.prototype, key, {
get () {
const that = this
return {
let key
let type = 'collection'
if (typeof entity === 'object') {
key = `$${entity.name}`
type = entity.type || 'collection'
entity = entity.name
} else {
key = `$${entity}`
}
if (Strapi.prototype.hasOwnProperty(key)) {
return
}
Object.defineProperty(Strapi.prototype, key, {
get () {
const that = this
return ({
single: {
find (...args) {
return that.find(entity, ...args)
},
update (...args) {
return that.update(entity, ...args)
},
delete (...args) {
return that.delete(entity, ...args)
}
},
collection: {
find (...args) {
return that.find(entity, ...args)
},
findOne (...args) {

@@ -180,5 +207,6 @@ return that.findOne(entity, ...args)

}
}
})
})[type]
}
})
})

@@ -199,3 +227,3 @@ const strapi = new Strapi(ctx)

if (process.client && nuxtState.strapi) {
strapi.state = nuxtState.strapi
strapi.state = Vue.observable(nuxtState.strapi)
}

@@ -202,0 +230,0 @@

{
"name": "@nuxtjs/strapi",
"version": "0.1.4",
"version": "0.1.5",
"description": "Strapi module for NuxtJS",

@@ -25,3 +25,3 @@ "repository": "nuxt-community/strapi-module",

"dependencies": {
"@nuxt/http": "^0.5.10",
"@nuxt/http": "^0.5.11",
"cookie-universal-nuxt": "^2.1.4",

@@ -28,0 +28,0 @@ "defu": "^3.1.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc