From 9f696fab34e74286c5fa6c746a2379f652aa5af2 Mon Sep 17 00:00:00 2001 From: Nick Perez Date: Mon, 25 Jun 2018 12:41:58 -0400 Subject: [PATCH 1/3] Added Context to api_handler arguments --- lib/plugins/api.template.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/plugins/api.template.js b/lib/plugins/api.template.js index f690762..e099747 100644 --- a/lib/plugins/api.template.js +++ b/lib/plugins/api.template.js @@ -39,7 +39,7 @@ function injectParamsIntoPath(path, params) { * @param controllerMapping * @return Object */ -function generateAPI(controllerMapping) { +function generateAPI(controllerMapping, ctx) { const api = {}; Object.keys(controllerMapping).forEach(function (key) { const context = controllerMapping[key]; @@ -54,19 +54,21 @@ function generateAPI(controllerMapping) { ), context.verb, values || {}, - <%= options.apiConfig %> + <%= options.apiConfig %>, + ctx ).then(runResponseMiddleware); } } else if (typeof controllerMapping[key] === 'object') { - api[key] = generateAPI(controllerMapping[key]); + api[key] = generateAPI(controllerMapping[key], ctx); } }); return api; } -export default ({app, req}) => { - const $api = process.server ? req._controllersTree : generateAPI(<%= options.controllers %>); +export default (context) => { + const {app, req} = context; + const $api = process.server ? req._controllersTree : generateAPI(<%= options.controllers %>, context); app.$api = $api; Vue.prototype.$api = $api; }; From 3635a621284a47c44f0ef0ce00d9c478780ebeae Mon Sep 17 00:00:00 2001 From: Nick Perez Date: Fri, 29 Jun 2018 22:51:52 -0400 Subject: [PATCH 2/3] change from using context -> use app --- lib/plugins/api.template.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/plugins/api.template.js b/lib/plugins/api.template.js index e099747..436cbd3 100644 --- a/lib/plugins/api.template.js +++ b/lib/plugins/api.template.js @@ -39,7 +39,7 @@ function injectParamsIntoPath(path, params) { * @param controllerMapping * @return Object */ -function generateAPI(controllerMapping, ctx) { +function generateAPI(controllerMapping, app) { const api = {}; Object.keys(controllerMapping).forEach(function (key) { const context = controllerMapping[key]; @@ -55,20 +55,19 @@ function generateAPI(controllerMapping, ctx) { context.verb, values || {}, <%= options.apiConfig %>, - ctx + app ).then(runResponseMiddleware); } } else if (typeof controllerMapping[key] === 'object') { - api[key] = generateAPI(controllerMapping[key], ctx); + api[key] = generateAPI(controllerMapping[key], app); } }); return api; } -export default (context) => { - const {app, req} = context; - const $api = process.server ? req._controllersTree : generateAPI(<%= options.controllers %>, context); +export default ({app, req}) => { + const $api = process.server ? req._controllersTree : generateAPI(<%= options.controllers %>, app); app.$api = $api; Vue.prototype.$api = $api; }; From 63408fb943a847ef432b9ed4cce2fa414b2cccb8 Mon Sep 17 00:00:00 2001 From: Pedro Pereira Date: Tue, 3 Jul 2018 14:29:24 +0100 Subject: [PATCH 3/3] chore(release): 1.3.0 --- CHANGELOG.md | 5 +++++ package-lock.json | 2 +- package.json | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f691834..ed78601 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +# [1.3.0](https://github.com/ezypeeze/nuxt-neo/compare/v1.2.1...v1.3.0) (2018-07-03) + + + ## [1.2.1](https://github.com/ezypeeze/nuxt-neo/compare/v1.2.0...v1.2.1) (2018-06-12) diff --git a/package-lock.json b/package-lock.json index 9607f06..ab22b2b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "nuxt-neo", - "version": "1.2.1", + "version": "1.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 15d623b..c84b75a 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuxt-neo", - "version": "1.2.1", + "version": "1.3.0", "description": "A nuxt.js module that implements a universal api layer, same-way compatible between server and client side.", "keywords": [ "nuxt",