mirror of
https://github.com/arthurfiorette/axios-cache-interceptor.git
synced 2025-12-08 17:36:16 +00:00
fix: comments to outputs and removed # path alias
This commit is contained in:
parent
cc6332ff24
commit
4592d180c4
@ -1,3 +1,2 @@
|
||||
/dist
|
||||
/ignore
|
||||
/node_modules
|
||||
@ -1,7 +1,7 @@
|
||||
import { applyRequestInterceptor } from '#/interceptors/request';
|
||||
import { applyResponseInterceptor } from '#/interceptors/response';
|
||||
import { MemoryStorage } from '#/storage/memory';
|
||||
import { defaultKeyGenerator } from '#/utils/key-generator';
|
||||
import { applyRequestInterceptor } from '../interceptors/request';
|
||||
import { applyResponseInterceptor } from '../interceptors/response';
|
||||
import { MemoryStorage } from '../storage/memory';
|
||||
import { defaultKeyGenerator } from '../utils/key-generator';
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { AxiosCacheInstance, CacheInstance, CacheRequestConfig } from './types';
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { CacheStorage } from '#/storage/types';
|
||||
import { CacheStorage } from '../storage/types';
|
||||
import type {
|
||||
AxiosInstance,
|
||||
AxiosInterceptorManager,
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { AxiosCacheInstance } from '#/axios/types';
|
||||
import { AxiosCacheInstance } from '../axios/types';
|
||||
import {
|
||||
CACHED_RESPONSE_STATUS,
|
||||
CACHED_RESPONSE_STATUS_TEXT
|
||||
} from '#/constants';
|
||||
import { Deferred } from '#/utils/deferred';
|
||||
} from '../constants';
|
||||
import { Deferred } from '../utils/deferred';
|
||||
|
||||
export function applyRequestInterceptor(axios: AxiosCacheInstance) {
|
||||
axios.interceptors.request.use(async (config) => {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { AxiosCacheInstance } from '#/axios/types';
|
||||
import { AxiosCacheInstance } from '../axios/types';
|
||||
import { parse } from '@tusbar/cache-control';
|
||||
|
||||
export function applyResponseInterceptor(axios: AxiosCacheInstance) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Deferred } from '#/utils/deferred';
|
||||
import { Deferred } from '../utils/deferred';
|
||||
|
||||
export interface CacheStorage {
|
||||
/**
|
||||
|
||||
16
src/test.ts
16
src/test.ts
@ -1,16 +0,0 @@
|
||||
import axios from 'axios';
|
||||
import { createCache } from './';
|
||||
import { SessionCacheStorage } from './storage';
|
||||
|
||||
// My own api
|
||||
const api = axios.create();
|
||||
|
||||
const cache = createCache(api, {
|
||||
// Store values on window.sessionStorage
|
||||
storage: new SessionCacheStorage(),
|
||||
|
||||
// Use the max-age header to determina the cache expiration time
|
||||
interpretHeader: true
|
||||
});
|
||||
|
||||
cache.get('http://example.com/');
|
||||
@ -1,4 +1,4 @@
|
||||
import { CacheRequestConfig } from '#/axios/types';
|
||||
import { CacheRequestConfig } from '../axios/types';
|
||||
|
||||
export function defaultKeyGenerator({
|
||||
baseURL,
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
// "composite": true, /* Enable project compilation */
|
||||
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
||||
"removeComments": true /* Do not emit comments to output. */,
|
||||
// "removeComments": true /* Do not emit comments to output. */,
|
||||
// "noEmit": true, /* Do not emit outputs. */
|
||||
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||
"downlevelIteration": true /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */,
|
||||
@ -45,9 +45,7 @@
|
||||
/* Module Resolution Options */
|
||||
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||
"baseUrl": "./" /* Base directory to resolve non-absolute module names. */,
|
||||
"paths": {
|
||||
"#/*": ["./src/*"]
|
||||
} /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
|
||||
// "paths": {} /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
|
||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||
// "types": [], /* Type declaration files to be included in compilation. */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user