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

nuxt-resource-module

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-resource-module - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="0.5.0"></a>
# [0.5.0](https://github.com/mya-ake/nuxt-resource-module/compare/v0.4.1...v0.5.0) (2018-12-16)
### Features
* Add request method [#11](https://github.com/mya-ake/nuxt-resource-module/issues/11) ([#12](https://github.com/mya-ake/nuxt-resource-module/issues/12)) ([807b045](https://github.com/mya-ake/nuxt-resource-module/commit/807b045))
<a name="0.4.1"></a>

@@ -7,0 +17,0 @@ ## [0.4.1](https://github.com/mya-ake/nuxt-resource-module/compare/v0.4.0...v0.4.1) (2018-11-09)

1

dist/core/Resource.d.ts

@@ -10,2 +10,3 @@ import { RequestMethod, ResourceConstructor, ResourceRequestMethods, ResourceDelayProperty, ResourceMayBeCancelProperty } from '@/interfaces';

mayBeCancel: ResourceMayBeCancelProperty;
request: RequestMethod;
get?: RequestMethod;

@@ -12,0 +13,0 @@ delete?: RequestMethod;

29

dist/core/Resource.js

@@ -60,2 +60,3 @@ var __assign = (this && this.__assign) || function () {

this.cancelSources = new Map();
this.request = this.createMethod('request');
this.buildMethods(methods);

@@ -103,16 +104,20 @@ this.delay = this.buildDelayMethods(methods);

var _this_1 = this;
return (function (config) {
if (config === void 0) { config = createDefaultResourceRequestConfig(); }
return (function (_config) {
if (_config === void 0) { _config = createDefaultResourceRequestConfig(); }
return __awaiter(_this_1, void 0, void 0, function () {
var response;
var config, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.axios
.request(__assign({}, config, { method: methodName }))
.then(function (response) {
return __assign({}, response, { canceled: false, delayed: false });
})
.catch(function (err) {
return __assign({}, err.response, { canceled: axios.isCancel(err) });
})];
case 0:
config = methodName === 'request'
? _config
: __assign({}, _config, { method: methodName });
return [4 /*yield*/, this.axios
.request(config)
.then(function (response) {
return __assign({}, response, { canceled: false, delayed: false });
})
.catch(function (err) {
return __assign({}, err.response, { canceled: axios.isCancel(err) });
})];
case 1:

@@ -129,2 +134,3 @@ response = _a.sent();

var _this = this;
delay.request = this.createDelayMethod('request');
methodNames.forEach(function (methodName) {

@@ -163,2 +169,3 @@ Object.defineProperty(delay, methodName, {

var _this = this;
mayBeCancel.request = this.createMayBeCancelMethod('request');
methodNames.forEach(function (methodName) {

@@ -165,0 +172,0 @@ Object.defineProperty(mayBeCancel, methodName, {

@@ -1,1 +0,1 @@

export declare type MethodName = 'get' | 'delete' | 'head' | 'post' | 'put' | 'patch';
export declare type MethodName = 'request' | 'get' | 'delete' | 'head' | 'post' | 'put' | 'patch';

@@ -10,2 +10,3 @@ import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';

export interface ResourceRequestMethods {
request: RequestMethod;
get?: RequestMethod;

@@ -12,0 +13,0 @@ delete?: RequestMethod;

{
"name": "nuxt-resource-module",
"version": "0.4.1",
"version": "0.5.0",
"description": "@nuxtjs/axios based API request wrapper for Nuxt.js",

@@ -5,0 +5,0 @@ "main": "dist/module.js",

@@ -120,2 +120,3 @@ # Nuxt.js Resource Module

- $\_resource.request(config: ResourceRequestConfig)
- $\_resource.get(config: ResourceRequestConfig)

@@ -139,2 +140,3 @@ - $\_resource.delete(config: ResourceRequestConfig)

- $\_resource.delay.request(config: ResourceRequestConfig)
- $\_resource.delay.get(config: ResourceRequestConfig)

@@ -152,2 +154,3 @@ - $\_resource.delay.delete(config: ResourceRequestConfig)

- $\_resource.mayBeCancel.request(config: ResourceRequestConfig)
- $\_resource.mayBeCancel.get(config: ResourceRequestConfig)

@@ -239,2 +242,4 @@ - $\_resource.mayBeCancel.delete(config: ResourceRequestConfig)

data: response.data,
delayed: response.delayed,
canceled: response.canceled,
};

@@ -241,0 +246,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