web: update to new formatting rules, make eslint warnings fail ci

This commit is contained in:
Jens Langhammer
2020-12-01 17:27:19 +01:00
parent 7195b77606
commit e6391b64f0
33 changed files with 192 additions and 259 deletions

View File

@ -1,5 +1,5 @@
import { getCookie } from "../../utils";
import { customElement, html, property } from "lit-element";
import { customElement, property } from "lit-element";
import { ERROR_CLASS, SUCCESS_CLASS } from "../../constants";
import { SpinnerButton } from "./SpinnerButton";
@ -8,21 +8,26 @@ export class ActionButton extends SpinnerButton {
@property()
url = "";
callAction() {
callAction(): void {
if (this.isRunning === true) {
return;
}
this.setLoading();
const csrftoken = getCookie("passbook_csrf");
if (!csrftoken) {
console.debug("No csrf token in cookie");
this.setDone(ERROR_CLASS);
return;
}
const request = new Request(this.url, {
headers: { "X-CSRFToken": csrftoken! },
headers: { "X-CSRFToken": csrftoken },
});
fetch(request, {
method: "POST",
mode: "same-origin",
})
.then((r) => r.json())
.then((r) => {
.then(() => {
this.setDone(SUCCESS_CLASS);
})
.catch(() => {