New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

axios-hooks

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-hooks - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

src/index.test.ssr.js

7

CHANGELOG.md

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

### [1.4.1](https://github.com/simoneb/axios-hooks/compare/v1.3.0...v1.4.1) (2019-10-19)
### Bug Fixes
* do not execute manual requests on server ([88829b0](https://github.com/simoneb/axios-hooks/commit/88829b0206673f411367eae67b018dae0c48b059))
## [1.4.0](https://github.com/simoneb/axios-hooks/compare/v1.3.0...v1.4.0) (2019-10-12)

@@ -7,0 +14,0 @@

10

es/index.js

@@ -11,3 +11,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

};
var ssrPromises = [];
export var __ssrPromises = [];
var cache;

@@ -45,4 +45,4 @@ var axiosInstance;

case 0:
ssrPromisesCopy = [].concat(ssrPromises);
ssrPromises.length = 0;
ssrPromisesCopy = [].concat(__ssrPromises);
__ssrPromises.length = 0;
_context.next = 4;

@@ -220,4 +220,4 @@ return Promise.all(ssrPromisesCopy);

if (typeof window === 'undefined') {
ssrPromises.push(axiosInstance(_extends({}, config, {
if (typeof window === 'undefined' && !options.manual) {
__ssrPromises.push(axiosInstance(_extends({}, config, {
adapter: cacheAdapter

@@ -224,0 +224,0 @@ })));

@@ -8,24 +8,24 @@ import {

AxiosResponse
} from "axios";
import LRUCache from "lru-cache";
} from 'axios'
import LRUCache from 'lru-cache'
interface ResponseValues<T> {
data: T;
loading: boolean;
error?: AxiosError;
response?: AxiosResponse;
data: T
loading: boolean
error?: AxiosError
response?: AxiosResponse
}
interface Options {
manual?: boolean;
useCache?: boolean;
manual?: boolean
useCache?: boolean
}
interface RefetchOptions {
useCache?: boolean;
useCache?: boolean
}
interface ConfigureOptions {
axios?: AxiosInstance | AxiosStatic | any;
cache?: LRUCache<any, any>;
axios?: AxiosInstance | AxiosStatic | any
cache?: LRUCache<any, any>
}

@@ -39,5 +39,11 @@

(config?: AxiosRequestConfig, options?: RefetchOptions) => void
];
]
export function configure(options: ConfigureOptions): void;
export function resetConfigure(): void;
export function loadCache(data: any[]): void
export function serializeCache(): any[]
export function configure(options: ConfigureOptions): void
export function resetConfigure(): void
// private
export const __ssrPromises: Promise<any>[]

@@ -11,2 +11,3 @@ "use strict";

exports["default"] = useAxios;
exports.__ssrPromises = void 0;

@@ -29,3 +30,4 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));

};
var ssrPromises = [];
var __ssrPromises = [];
exports.__ssrPromises = __ssrPromises;
var cache;

@@ -68,4 +70,4 @@ var axiosInstance;

case 0:
ssrPromisesCopy = [].concat(ssrPromises);
ssrPromises.length = 0;
ssrPromisesCopy = [].concat(__ssrPromises);
__ssrPromises.length = 0;
_context.next = 4;

@@ -243,4 +245,4 @@ return Promise.all(ssrPromisesCopy);

if (typeof window === 'undefined') {
ssrPromises.push(axiosInstance((0, _extends3["default"])({}, config, {
if (typeof window === 'undefined' && !options.manual) {
__ssrPromises.push(axiosInstance((0, _extends3["default"])({}, config, {
adapter: cacheAdapter

@@ -247,0 +249,0 @@ })));

{
"name": "axios-hooks",
"version": "1.4.0",
"version": "1.4.1",
"description": "axios-hooks",

@@ -34,3 +34,3 @@ "keywords": [

"release": "standard-version",
"pretest": "cp ./src/index.test.js ./src/index.test.ts && cp ./index.d.ts ./src",
"pretest": "cp ./src/index.test.js ./src/index.test.ts && cp ./src/index.test.ssr.js ./src/index.test.ssr.ts && cp ./index.d.ts ./src",
"test": "jest --no-cache"

@@ -37,0 +37,0 @@ },

@@ -8,24 +8,24 @@ import {

AxiosResponse
} from "axios";
import LRUCache from "lru-cache";
} from 'axios'
import LRUCache from 'lru-cache'
interface ResponseValues<T> {
data: T;
loading: boolean;
error?: AxiosError;
response?: AxiosResponse;
data: T
loading: boolean
error?: AxiosError
response?: AxiosResponse
}
interface Options {
manual?: boolean;
useCache?: boolean;
manual?: boolean
useCache?: boolean
}
interface RefetchOptions {
useCache?: boolean;
useCache?: boolean
}
interface ConfigureOptions {
axios?: AxiosInstance | AxiosStatic | any;
cache?: LRUCache<any, any>;
axios?: AxiosInstance | AxiosStatic | any
cache?: LRUCache<any, any>
}

@@ -39,5 +39,11 @@

(config?: AxiosRequestConfig, options?: RefetchOptions) => void
];
]
export function configure(options: ConfigureOptions): void;
export function resetConfigure(): void;
export function loadCache(data: any[]): void
export function serializeCache(): any[]
export function configure(options: ConfigureOptions): void
export function resetConfigure(): void
// private
export const __ssrPromises: Promise<any>[]

@@ -10,3 +10,3 @@ import React from 'react'

const ssrPromises = []
export const __ssrPromises = []

@@ -38,5 +38,5 @@ let cache

export async function serializeCache() {
const ssrPromisesCopy = [...ssrPromises]
const ssrPromisesCopy = [...__ssrPromises]
ssrPromises.length = 0
__ssrPromises.length = 0

@@ -135,4 +135,4 @@ await Promise.all(ssrPromisesCopy)

if (typeof window === 'undefined') {
ssrPromises.push(axiosInstance({ ...config, adapter: cacheAdapter }))
if (typeof window === 'undefined' && !options.manual) {
__ssrPromises.push(axiosInstance({ ...config, adapter: cacheAdapter }))
}

@@ -139,0 +139,0 @@

@@ -154,3 +154,3 @@ import { renderHook, act } from '@testing-library/react-hooks'

expect(axios).toHaveBeenCalledTimes(1)
expect(axios).toHaveBeenLastCalledWith(
expect(axios).toHaveBeenCalledWith(
expect.objectContaining({ adapter: expect.any(Function) })

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