cc-api-next
Advanced tools
Comparing version 1.0.3 to 1.0.4
10
index.js
const fetch = require('isomorphic-unfetch'); | ||
import Cookies from 'universal-cookie'; | ||
const cookies = new Cookies(); | ||
class Api { | ||
@@ -14,11 +17,12 @@ | ||
this.headers['x-token'] = props.token || this.token || ''; | ||
} | ||
setToken(token){ | ||
this.headers['x-token'] = token; | ||
this.headers['x-token'] = token || cookies.get(this.tokenKey); | ||
} | ||
async call(path, data, config) { | ||
if(!this.headers['x-token']){ | ||
this.setToken(); | ||
} | ||
if(config === undefined){ | ||
@@ -25,0 +29,0 @@ config = data || {}; |
{ | ||
"name": "cc-api-next", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "cc api next", | ||
@@ -23,4 +23,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"isomorphic-unfetch": "^3.0.0" | ||
"isomorphic-unfetch": "^3.0.0", | ||
"universal-cookie": "^4.0.2" | ||
} | ||
} |
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
1869
45
2
+ Addeduniversal-cookie@^4.0.2
+ Added@types/cookie@0.3.3(transitive)
+ Addedcookie@0.4.2(transitive)
+ Addeduniversal-cookie@4.0.4(transitive)