mirror of
https://github.com/miniflux/v2.git
synced 2025-07-22 17:18:37 +00:00
Refactor WebAuthn Javascript code
This commit is contained in:
parent
a75256bed5
commit
2b8342fcd5
9 changed files with 226 additions and 218 deletions
|
@ -9,7 +9,7 @@ class RequestBuilder {
|
|||
body: null,
|
||||
headers: new Headers({
|
||||
"Content-Type": "application/json",
|
||||
"X-Csrf-Token": this.getCsrfToken()
|
||||
"X-Csrf-Token": getCsrfToken()
|
||||
})
|
||||
};
|
||||
}
|
||||
|
@ -29,15 +29,6 @@ class RequestBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
getCsrfToken() {
|
||||
let element = document.querySelector("body[data-csrf-token]");
|
||||
if (element !== null) {
|
||||
return element.dataset.csrfToken;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
execute() {
|
||||
fetch(new Request(this.url, this.options)).then((response) => {
|
||||
if (this.callback) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue