From 5076b6abfdcf284e93062f22ddd4c965f808a2e3 Mon Sep 17 00:00:00 2001 From: Matchlighter Date: Mon, 30 Apr 2018 12:33:57 -0600 Subject: [PATCH] Use js-cookie (MIT) instead of doc-cookies (GPLv3) --- package.json | 2 +- src/FamilySearch.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 1d08e1e..9bf66ef 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "webpack": "^1.13.3" }, "dependencies": { - "doc-cookies": "^1.0.2", + "js-cookie": "^2.2.0", "request": "^2.78.0" }, "files": [ diff --git a/src/FamilySearch.js b/src/FamilySearch.js index 7ce8426..1b51d4c 100644 --- a/src/FamilySearch.js +++ b/src/FamilySearch.js @@ -1,4 +1,4 @@ -var cookies = require('doc-cookies'), +var cookies = require('js-cookie'), Request = require('./Request'), requestHandler = require('./nodeHandler'), utils = require('./utils'), @@ -93,7 +93,7 @@ FamilySearch.prototype.config = function(options){ // has already been processed above so we check the SDK to see whether or not // an access token is already available. if(options.saveAccessToken && !this.getAccessToken()) { - var token = cookies.getItem(this.tokenCookie); + var token = cookies.get(this.tokenCookie); if(token){ this.setAccessToken(token); } @@ -260,7 +260,7 @@ FamilySearch.prototype.setAccessToken = function(accessToken){ if(this.saveAccessToken){ // Expire in 24 hours because tokens never last longer than that, though // they can expire before that after 1 hour of inactivity. - cookies.setItem(this.tokenCookie, accessToken, 86400, this.tokenCookiePath); + cookies.set(this.tokenCookie, accessToken, { expires: 1, path: this.tokenCookiePath }); } return this; }; @@ -282,7 +282,7 @@ FamilySearch.prototype.getAccessToken = function(){ FamilySearch.prototype.deleteAccessToken = function(){ this.accessToken = undefined; if(this.saveAccessToken){ - cookies.removeItem(this.tokenCookie, this.tokenCookiePath); + cookies.remove(this.tokenCookie, { path: this.tokenCookiePath }); } return this; };