patch: fixes extra ajax call on movie options page
This commit is contained in:
@@ -18,13 +18,15 @@ export default class extends Controller {
|
|||||||
static targets = ['list']
|
static targets = ['list']
|
||||||
|
|
||||||
options = []
|
options = []
|
||||||
|
optionsLoaded = false
|
||||||
|
|
||||||
async connect() {
|
async connect() {
|
||||||
await this.setOptions();
|
await this.setOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
async setOptions() {
|
async setOptions() {
|
||||||
if (this.options.length === 0) {
|
if (false === this.optionsLoaded) {
|
||||||
|
this.optionsLoaded = true;
|
||||||
await fetch(`/torrentio/movies/${this.tmdbIdValue}/${this.imdbIdValue}`)
|
await fetch(`/torrentio/movies/${this.tmdbIdValue}/${this.imdbIdValue}`)
|
||||||
.then(res => res.text())
|
.then(res => res.text())
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|||||||
Reference in New Issue
Block a user