Skip to content

Commit d2dc8ef

Browse files
committed
refactor: renaming ambiguous local variable apiURL to initialRequestURL
1 parent ea7300c commit d2dc8ef

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

html/classhelper.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ class ClassHelper extends HTMLElement {
103103
trackerBaseURL = null;
104104

105105
connectedCallback() {
106-
/** @type {URL} */
107-
let apiURL;
108-
109106
try {
110107
this.helpurl = this.findClassHelpLink();
111108

@@ -128,15 +125,7 @@ class ClassHelper extends HTMLElement {
128125
return;
129126
}
130127

131-
try {
132-
apiURL = ClassHelper.getRestURL(this.trackerBaseURL, this.helpurlProps);
133-
} catch (e) {
134-
// Failed parsing props -> reset, log and return.
135-
this.helpurl.removeEventListener("click", this.preventDefault);
136-
this.helpurl.setAttribute("onclick", this.helpurlScript);
137-
console.error(e.message);
138-
return;
139-
}
128+
const initialRequestURL = ClassHelper.getRestURL(this.trackerBaseURL, this.helpurlProps);
140129

141130
ClassHelper.fetchTranslations().catch(error => {
142131
// Top level handling for translation errors.
@@ -157,7 +146,7 @@ class ClassHelper extends HTMLElement {
157146
}
158147

159148
const handleClickEvent = (event) => {
160-
this.openPopUp(apiURL, this.helpurlProps).catch(error => {
149+
this.openPopUp(initialRequestURL, this.helpurlProps).catch(error => {
161150
// Top level error handling for openPopUp method.
162151
cleanUpClosure();
163152
});
@@ -404,7 +393,6 @@ class ClassHelper extends HTMLElement {
404393
* we pass helpurl which is parsed from anchor tag and return a URL.
405394
* @param {HelpUrlProps} props
406395
* @returns {URL}
407-
* @throws {Error}
408396
*/
409397
static getRestURL(trackerBaseURL, props) {
410398
const restDataPath = "rest/data";

0 commit comments

Comments
 (0)