lesca-fetcher
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -20,4 +20,3 @@ export declare enum contentType { | ||
setJWT: (jwt: string) => void; | ||
setHeader: (parm: object) => void; | ||
}; | ||
export default Fetcher; |
@@ -29,3 +29,2 @@ "use strict"; | ||
var format; | ||
var currentHeaders; | ||
var install = function install(setting) { | ||
@@ -45,5 +44,2 @@ var set = _objectSpread(_objectSpread({}, defaultConfig), setting); | ||
}; | ||
var setHeader = function setHeader(parm) { | ||
currentHeaders = parm; | ||
}; | ||
var mergePath = exports.mergePath = function mergePath() { | ||
@@ -63,3 +59,2 @@ var api = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '/api'; | ||
} | ||
var finalHeaders = _objectSpread(_objectSpread({}, headers), currentHeaders); | ||
return new Promise(function (resolve, reject) { | ||
@@ -69,3 +64,3 @@ fetch(mergePath(api), { | ||
body: body, | ||
headers: finalHeaders | ||
headers: headers | ||
}).then(function (res) { | ||
@@ -93,7 +88,6 @@ if (format === formatType.JSON) { | ||
var method = 'GET'; | ||
var finalHeaders = _objectSpread(_objectSpread({}, headers), currentHeaders); | ||
return new Promise(function (resolve, reject) { | ||
fetch(mergePath(api), { | ||
method: method, | ||
headers: finalHeaders | ||
headers: headers | ||
}).then(function (res) { | ||
@@ -122,5 +116,4 @@ if (format === formatType.JSON) { | ||
get: get, | ||
setJWT: setJWT, | ||
setHeader: setHeader | ||
setJWT: setJWT | ||
}; | ||
var _default = exports["default"] = Fetcher; |
{ | ||
"name": "lesca-fetcher", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "Integrate fetch for easier use", | ||
@@ -22,21 +22,21 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@babel/cli": "^7.22.15", | ||
"@babel/core": "^7.22.20", | ||
"@babel/cli": "^7.23.0", | ||
"@babel/core": "^7.23.2", | ||
"@babel/plugin-proposal-class-properties": "^7.18.6", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.20.7", | ||
"@babel/plugin-transform-runtime": "^7.22.15", | ||
"@babel/preset-env": "^7.22.20", | ||
"@babel/plugin-transform-runtime": "^7.23.2", | ||
"@babel/preset-env": "^7.23.2", | ||
"@babel/preset-react": "^7.22.15", | ||
"@babel/preset-typescript": "^7.22.15", | ||
"@babel/preset-typescript": "^7.23.2", | ||
"@emotion/react": "^11.11.1", | ||
"@emotion/styled": "^11.11.0", | ||
"@mui/icons-material": "^5.14.9", | ||
"@mui/material": "^5.14.10", | ||
"autoprefixer": "^10.4.15", | ||
"@mui/icons-material": "^5.14.16", | ||
"@mui/material": "^5.14.17", | ||
"autoprefixer": "^10.4.16", | ||
"babel-loader": "^9.1.3", | ||
"concurrently": "^8.2.1", | ||
"concurrently": "^8.2.2", | ||
"css-loader": "^6.8.1", | ||
"file-loader": "^6.2.0", | ||
"gh-pages": "^6.0.0", | ||
"html-react-parser": "^4.2.2", | ||
"html-react-parser": "^5.0.6", | ||
"html-webpack-plugin": "^5.5.3", | ||
@@ -47,3 +47,3 @@ "lesca-url-parameters": "^2.0.7", | ||
"less-vars-to-js": "^1.3.0", | ||
"postcss": "^8.4.30", | ||
"postcss": "^8.4.31", | ||
"postcss-loader": "^7.3.3", | ||
@@ -54,5 +54,5 @@ "prismjs": "^1.29.0", | ||
"style-loader": "^3.3.3", | ||
"ts-loader": "^9.4.4", | ||
"ts-loader": "^9.5.0", | ||
"typescript": "^5.2.2", | ||
"webpack": "^5.88.2", | ||
"webpack": "^5.89.0", | ||
"webpack-cli": "^5.1.4", | ||
@@ -59,0 +59,0 @@ "webpack-dev-server": "^4.15.1" |
@@ -28,4 +28,3 @@ [![NPM](https://img.shields.io/badge/NPM-ba443f?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/) | ||
Fetcher.setJWT('Fsr.956b6.67ktJGr'); // if necessary | ||
Fetcher.setHeader({ mode:'cores' }) // if necessary | ||
Fetch.setJWT('Fsr.956b6.67ktJGr'); // if necessary | ||
@@ -32,0 +31,0 @@ |
@@ -31,3 +31,2 @@ export enum contentType { | ||
let format: formatType; | ||
let currentHeaders: object; | ||
@@ -49,6 +48,2 @@ const install = (setting: Config) => { | ||
const setHeader = (parm: object) => { | ||
currentHeaders = parm; | ||
}; | ||
export const mergePath = (api: String = '/api') => { | ||
@@ -68,5 +63,4 @@ return api.slice(0, 1) === '/' ? `${host}${api}` : `${host}/${api}`; | ||
const finalHeaders = { ...headers, ...currentHeaders }; | ||
return new Promise((resolve, reject) => { | ||
fetch(mergePath(api), { method, body, headers: finalHeaders }) | ||
fetch(mergePath(api), { method, body, headers }) | ||
.then((res) => { | ||
@@ -91,6 +85,5 @@ if (format === formatType.JSON) { | ||
const method = 'GET'; | ||
const finalHeaders = { ...headers, ...currentHeaders }; | ||
return new Promise((resolve, reject) => { | ||
fetch(mergePath(api), { method, headers: finalHeaders }) | ||
fetch(mergePath(api), { method, headers }) | ||
.then((res) => { | ||
@@ -118,5 +111,4 @@ if (format === formatType.JSON) { | ||
setJWT, | ||
setHeader, | ||
}; | ||
export default Fetcher; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
310857
1620
77