strona-czynna/src/front/controllers/task_controller.ts
Bezula 400705150e T2316 - Poprawione błędy lintera
Summary:
T2316

Test Plan: Wykonać komendę arc lint, powinno wyświetlić okey

Reviewers: #testers, kuba-orlik

Reviewed By: #testers, kuba-orlik

Subscribers: jenkins-user

Maniphest Tasks: T2316

Differential Revision: https://hub.sealcode.org/D1150
2021-07-31 09:47:38 +02:00

24 lines
592 B
TypeScript

/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { Controller } from "stimulus";
export default class TaskController extends Controller {
id: string;
connect(): void {
this.id = this.element.attributes["data-id"].value;
}
async toggle(event: Event): Promise<void> {
await fetch(`/api/v1/collections/tasks/${this.id}`, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
done: (event.target as HTMLInputElement).checked,
}),
});
}
}