mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Replace a bunch of let
with const
According to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const > Many style guides (including MDN's) recommend using const over let whenever a variable is not reassigned in its scope. This makes the intent clear that a variable's type (or value, in the case of a primitive) can never change.
This commit is contained in:
parent
fc4bdf3ab0
commit
beb8c80787
6 changed files with 41 additions and 44 deletions
|
@ -5,7 +5,7 @@ class WebAuthnHandler {
|
|||
|
||||
static showErrorMessage(errorMessage) {
|
||||
console.log("webauthn error: " + errorMessage);
|
||||
let alertElement = document.getElementById("webauthn-error");
|
||||
const alertElement = document.getElementById("webauthn-error");
|
||||
if (alertElement) {
|
||||
alertElement.textContent += " (" + errorMessage + ")";
|
||||
alertElement.classList.remove("hidden");
|
||||
|
@ -79,14 +79,14 @@ class WebAuthnHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
let credentialCreationOptions = await registerBeginResponse.json();
|
||||
const credentialCreationOptions = await registerBeginResponse.json();
|
||||
credentialCreationOptions.publicKey.challenge = this.decodeBuffer(credentialCreationOptions.publicKey.challenge);
|
||||
credentialCreationOptions.publicKey.user.id = this.decodeBuffer(credentialCreationOptions.publicKey.user.id);
|
||||
if (Object.hasOwn(credentialCreationOptions.publicKey, 'excludeCredentials')) {
|
||||
credentialCreationOptions.publicKey.excludeCredentials.forEach((credential) => credential.id = this.decodeBuffer(credential.id));
|
||||
}
|
||||
|
||||
let attestation = await navigator.credentials.create(credentialCreationOptions);
|
||||
const attestation = await navigator.credentials.create(credentialCreationOptions);
|
||||
|
||||
let registrationFinishResponse;
|
||||
try {
|
||||
|
@ -108,7 +108,7 @@ class WebAuthnHandler {
|
|||
throw new Error("Login failed with HTTP status code " + response.status);
|
||||
}
|
||||
|
||||
let jsonData = await registrationFinishResponse.json();
|
||||
const jsonData = await registrationFinishResponse.json();
|
||||
window.location.href = jsonData.redirect;
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ class WebAuthnHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
let credentialRequestOptions = await loginBeginResponse.json();
|
||||
const credentialRequestOptions = await loginBeginResponse.json();
|
||||
credentialRequestOptions.publicKey.challenge = this.decodeBuffer(credentialRequestOptions.publicKey.challenge);
|
||||
|
||||
if (Object.hasOwn(credentialRequestOptions.publicKey, 'allowCredentials')) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue