27 lines
779 B
JavaScript
27 lines
779 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 = {
|
|
tmdbId: String,
|
|
imdbId: String,
|
|
season: String,
|
|
episode: String,
|
|
active: Boolean,
|
|
};
|
|
|
|
connect() {
|
|
if (true === this.activeValue) {
|
|
fetch(`/torrentio/tvshows/${this.tmdbIdValue}/${this.imdbIdValue}/${this.seasonValue}/${this.episodeValue}`)
|
|
.then(res => res.text())
|
|
.then(response => {
|
|
this.element.innerHTML = response;
|
|
});
|
|
}
|
|
}
|
|
}
|