Skip to content

Commit

Permalink
feat(samples): switch to session storage
Browse files Browse the repository at this point in the history
  • Loading branch information
arun3528 committed Oct 31, 2024
1 parent 7d27626 commit 2ece117
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ jobs:
- name: Build Webex Core
run: yarn workspace @webex/webex-core run build:src

- name: Build calling package (TODO fix is something wrong with tooling)
run: yarn workspace @webex/calling run build:src

- name: Build Other Packages
run: yarn workspaces foreach --parallel --verbose run build:src

Expand Down
16 changes: 8 additions & 8 deletions docs/samples/contact-center/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ const agentLoginButton = document.querySelector('#loginAgent');
const dialNumber = document.querySelector('#dialNumber');
const registerStatus = document.querySelector('#ws-connection-status');

// Store and Grab `access-token` from localstorage
if (localStorage.getItem('date') > new Date().getTime()) {
tokenElm.value = localStorage.getItem('access-token');
// Store and Grab `access-token` from sessionStorage
if (sessionStorage.getItem('date') > new Date().getTime()) {
tokenElm.value = sessionStorage.getItem('access-token');
}
else {
localStorage.removeItem('access-token');
sessionStorage.removeItem('access-token');
}

tokenElm.addEventListener('change', (event) => {
localStorage.setItem('access-token', event.target.value);
localStorage.setItem('date', new Date().getTime() + (12 * 60 * 60 * 1000));
sessionStorage.setItem('access-token', event.target.value);
sessionStorage.setItem('date', new Date().getTime() + (12 * 60 * 60 * 1000));
});

function changeAuthType() {
Expand Down Expand Up @@ -185,8 +185,8 @@ if (window.location.hash) {
const expiresIn = urlParams.get('expires_in');

if (accessToken) {
localStorage.setItem('access-token', accessToken);
localStorage.setItem('date', new Date().getTime() + parseInt(expiresIn, 10));
sessionStorage.setItem('access-token', accessToken);
sessionStorage.setItem('date', new Date().getTime() + parseInt(expiresIn, 10));
tokenElm.value = accessToken;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@webex/plugin-cc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"node": ">=20.x"
},
"scripts": {
"build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts && yarn build",
"build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps && yarn build",
"build": "yarn run -T tsc --declaration true --declarationDir ./dist/types",
"docs": "typedoc --emit none",
"fix:lint": "eslint 'src/**/*.ts' --fix",
Expand Down

0 comments on commit 2ece117

Please sign in to comment.