25 lines
764 B
JavaScript
25 lines
764 B
JavaScript
import { Controller } from '@hotwired/stimulus';
|
|
|
|
/*
|
|
* The following line makes this controller "lazy": it won't be downloaded until needed
|
|
* See https://github.com/symfony/stimulus-bridge#lazy-controllers
|
|
*/
|
|
/* stimulusFetch: 'lazy' */
|
|
export default class extends Controller {
|
|
static values = {
|
|
title: String,
|
|
tmdbId: String,
|
|
imdbId: String,
|
|
mediaType: String,
|
|
}
|
|
|
|
addMovieMonitor() {
|
|
console.log(`/monitor/movies/${this.tmdbIdValue}/${this.imdbIdValue}/${encodeURI(this.titleValue)}`)
|
|
fetch(`/monitor/movies/${this.tmdbIdValue}/${this.imdbIdValue}/${encodeURI(this.titleValue)}`)
|
|
.then(res => res.json())
|
|
.then(json => {
|
|
console.log(json)
|
|
})
|
|
}
|
|
}
|