Skip to content

Commit

Permalink
fix: getAttribute error (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamYSF authored Apr 3, 2024
1 parent d95791f commit 6fafcaf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@ let accessToken;
let applicationName;

function getDomAccessToken() {
if(window.location.pathname != "/src/popup.html"){
accessToken = document.getElementById("CasdoorAccessToken").getAttribute("value");
applicationName = document.getElementById("CasdoorApplicationName").getAttribute("value");
const accessTokenDom = document.getElementById("CasdoorAccessToken")
const applicationNameDom = document.getElementById("CasdoorApplicationName")
if(window.location.pathname != "/src/popup.html" && accessTokenDom && applicationNameDom){
accessToken = accessTokenDom.getAttribute("value");
applicationName = applicationNameDom.getAttribute("value");
if (accessToken && applicationName) {
sdk.getUserProfile(accessToken).then((userProfile) => {
userProfile.applicationName = applicationName;
Expand Down

0 comments on commit 6fafcaf

Please sign in to comment.