Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F1262414
task-controller.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
621 B
Referenced Files
None
Subscribers
None
task-controller.ts
View Options
import
{
Controller
}
from
"stimulus"
;
export
default
class
TaskController
extends
Controller
{
id
:
string
;
connect
()
{
const
dataIdAttr
=
this
.
element
.
getAttribute
(
"data-id"
);
if
(
dataIdAttr
)
{
this
.
id
=
dataIdAttr
;
}
}
async
toggle
(
event
:
Event
)
{
const
inputElement
=
event
.
target
;
if
(
inputElement
instanceof
HTMLInputElement
)
{
const
isChecked
:
boolean
=
inputElement
.
checked
;
await
fetch
(
`/api/v1/collections/tasks/
${
this
.
id
}
`
,
{
method
:
"PATCH"
,
headers
:
{
"Content-Type"
:
"application/json"
,
},
body
:
JSON
.
stringify
({
done
:
isChecked
,
}),
});
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Thu, Jan 23, 23:00 (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
601002
Default Alt Text
task-controller.ts (621 B)
Attached To
Mode
rPHOTOAPP photo-app-demo
Attached
Detach File
Event Timeline
Log In to Comment