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

create-api-hooks

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-api-hooks - npm Package Compare versions

Comparing version 0.0.40 to 0.0.41

2

dist/index.d.ts

@@ -21,3 +21,3 @@ /// <reference types="react" />

*/
cache?: boolean;
cache?: boolean | 'local' | 'session';
/**

@@ -24,0 +24,0 @@ * 相同的接口和参数只会请求一次

@@ -16,3 +16,3 @@ import { useEffect, useState, useCallback, useRef } from 'react';

var _b = _a === void 0 ? {} : _a, _c = _b.cache, cache = _c === void 0 ? true : _c, _d = _b.initValue, initValue = _d === void 0 ? {} : _d, params = _b.params, _e = _b.needInit, needInit = _e === void 0 ? true : _e, _f = _b.deepCache, deepCache = _f === void 0 ? false : _f, debounceInterval = _b.debounceInterval;
initValue = cache
initValue = cache === 'local' ? localStorage.getItem(getRequestString(params)) : cache === 'session' ? sessionStorage.getItem(getRequestString(params)) : cache
? createApiHooksConfig.getCacheFn(getRequestString(params)) || initValue

@@ -35,4 +35,10 @@ : initValue;

var requestString = getRequestString(params);
var setCacheFn = createApiHooksConfig.setCacheFn;
var getCacheFn = createApiHooksConfig.getCacheFn;
var setCacheFn = {
local: function (name, value) { return localStorage.setItem(name, value); },
session: function (name, value) { return sessionStorage.setItem(name, value); },
}[cache + ''] || createApiHooksConfig.setCacheFn;
var getCacheFn = {
local: function (name) { return localStorage.getItem(name); },
session: function (name) { return sessionStorage.getItem(name); },
}[cache + ''] || createApiHooksConfig.getCacheFn;
if ((JSON.stringify(preParams.current) === JSON.stringify(params) &&

@@ -39,0 +45,0 @@ !isOutRequest) ||

@@ -20,3 +20,3 @@ 'use strict';

var _b = _a === void 0 ? {} : _a, _c = _b.cache, cache = _c === void 0 ? true : _c, _d = _b.initValue, initValue = _d === void 0 ? {} : _d, params = _b.params, _e = _b.needInit, needInit = _e === void 0 ? true : _e, _f = _b.deepCache, deepCache = _f === void 0 ? false : _f, debounceInterval = _b.debounceInterval;
initValue = cache
initValue = cache === 'local' ? localStorage.getItem(getRequestString(params)) : cache === 'session' ? sessionStorage.getItem(getRequestString(params)) : cache
? createApiHooksConfig.getCacheFn(getRequestString(params)) || initValue

@@ -39,4 +39,10 @@ : initValue;

var requestString = getRequestString(params);
var setCacheFn = createApiHooksConfig.setCacheFn;
var getCacheFn = createApiHooksConfig.getCacheFn;
var setCacheFn = {
local: function (name, value) { return localStorage.setItem(name, value); },
session: function (name, value) { return sessionStorage.setItem(name, value); },
}[cache + ''] || createApiHooksConfig.setCacheFn;
var getCacheFn = {
local: function (name) { return localStorage.getItem(name); },
session: function (name) { return sessionStorage.getItem(name); },
}[cache + ''] || createApiHooksConfig.getCacheFn;
if ((JSON.stringify(preParams.current) === JSON.stringify(params) &&

@@ -43,0 +49,0 @@ !isOutRequest) ||

{
"name": "create-api-hooks",
"version": "0.0.40",
"version": "0.0.41",
"description": "",

@@ -5,0 +5,0 @@ "author": "mushan0x0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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