@coursekit/client
Advanced tools
Comparing version 0.2.0 to 0.2.1-beta.0
@@ -404,14 +404,16 @@ 'use strict'; | ||
let refreshToken; | ||
const urlParams = new URLSearchParams(window.location.search); | ||
accessToken = urlParams.get('access_token'); | ||
refreshToken = urlParams.get('refresh_token'); | ||
if (accessToken && refreshToken) { | ||
const accessExpiry = new Date(new Date().getTime() + (30 * 1000)); | ||
const refreshExpiry = new Date(new Date().getTime() + (43200 * 60 * 1000)); | ||
Cookie__default["default"].set('access_token', accessToken, { expires: accessExpiry}); | ||
Cookie__default["default"].set('refresh_token', refreshToken, { expires: refreshExpiry }); | ||
window.history.replaceState({}, document.title, window.location.href.split('?')[0]); | ||
} else { | ||
accessToken = Cookie__default["default"].get('access_token'); | ||
refreshToken = Cookie__default["default"].get('refresh_token'); | ||
if (typeof window !== 'undefined') { | ||
const urlParams = new URLSearchParams(window.location.search); | ||
accessToken = urlParams.get('access_token'); | ||
refreshToken = urlParams.get('refresh_token'); | ||
if (accessToken && refreshToken) { | ||
const accessExpiry = new Date(new Date().getTime() + (30 * 1000)); | ||
const refreshExpiry = new Date(new Date().getTime() + (43200 * 60 * 1000)); | ||
Cookie__default["default"].set('access_token', accessToken, { expires: accessExpiry}); | ||
Cookie__default["default"].set('refresh_token', refreshToken, { expires: refreshExpiry }); | ||
window.history.replaceState({}, document.title, window.location.href.split('?')[0]); | ||
} else { | ||
accessToken = Cookie__default["default"].get('access_token'); | ||
refreshToken = Cookie__default["default"].get('refresh_token'); | ||
} | ||
} | ||
@@ -418,0 +420,0 @@ return { accessToken, refreshToken } |
@@ -15,14 +15,16 @@ import createCache from './createCache' | ||
let refreshToken | ||
const urlParams = new URLSearchParams(window.location.search) | ||
accessToken = urlParams.get('access_token') | ||
refreshToken = urlParams.get('refresh_token') | ||
if (accessToken && refreshToken) { | ||
const accessExpiry = new Date(new Date().getTime() + (30 * 1000)) | ||
const refreshExpiry = new Date(new Date().getTime() + (43200 * 60 * 1000)) | ||
Cookie.set('access_token', accessToken, { expires: accessExpiry}) | ||
Cookie.set('refresh_token', refreshToken, { expires: refreshExpiry }) | ||
window.history.replaceState({}, document.title, window.location.href.split('?')[0]) | ||
} else { | ||
accessToken = Cookie.get('access_token') | ||
refreshToken = Cookie.get('refresh_token') | ||
if (typeof window !== 'undefined') { | ||
const urlParams = new URLSearchParams(window.location.search) | ||
accessToken = urlParams.get('access_token') | ||
refreshToken = urlParams.get('refresh_token') | ||
if (accessToken && refreshToken) { | ||
const accessExpiry = new Date(new Date().getTime() + (30 * 1000)) | ||
const refreshExpiry = new Date(new Date().getTime() + (43200 * 60 * 1000)) | ||
Cookie.set('access_token', accessToken, { expires: accessExpiry}) | ||
Cookie.set('refresh_token', refreshToken, { expires: refreshExpiry }) | ||
window.history.replaceState({}, document.title, window.location.href.split('?')[0]) | ||
} else { | ||
accessToken = Cookie.get('access_token') | ||
refreshToken = Cookie.get('refresh_token') | ||
} | ||
} | ||
@@ -29,0 +31,0 @@ return { accessToken, refreshToken } |
{ | ||
"name": "@coursekit/client", | ||
"description": "CourseKit client library", | ||
"version": "0.2.0", | ||
"version": "0.2.1-beta.0", | ||
"main": "dist/library.js", | ||
@@ -6,0 +6,0 @@ "module": "dist/library.mjs", |
Sorry, the diff of this file is not supported yet
54585
1393