From f54aa0ec153e72a1ef34f9e04c1314ce17a2ffb8 Mon Sep 17 00:00:00 2001 From: AgustinSRG Date: Sun, 13 Oct 2024 15:13:05 +0200 Subject: [PATCH] Frontend: Use different request Ids for subtitles and audios --- .../src/components/player/editor/EditorAudios.vue | 14 +++++++++----- .../components/player/editor/EditorSubtitles.vue | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/frontend/src/components/player/editor/EditorAudios.vue b/frontend/src/components/player/editor/EditorAudios.vue index 01b2d0d..60e953d 100644 --- a/frontend/src/components/player/editor/EditorAudios.vue +++ b/frontend/src/components/player/editor/EditorAudios.vue @@ -162,7 +162,9 @@ export default defineComponent({ emits: ["changed"], setup() { return { - requestId: getUniqueStringId(), + requestIdAdd: getUniqueStringId(), + requestIdRename: getUniqueStringId(), + requestIdDelete: getUniqueStringId(), }; }, data: function () { @@ -267,7 +269,7 @@ export default defineComponent({ const mediaId = AppStatus.CurrentMedia; - makeNamedApiRequest(this.requestId, apiMediaSetAudioTrack(mediaId, id, name, this.audioFile)) + makeNamedApiRequest(this.requestIdAdd, apiMediaSetAudioTrack(mediaId, id, name, this.audioFile)) .onSuccess((res) => { PagesController.ShowSnackBarRight(this.$t("Added audio track") + ": " + res.name); this.busy = false; @@ -342,7 +344,7 @@ export default defineComponent({ const mediaId = AppStatus.CurrentMedia; const id = aud.id; - makeNamedApiRequest(this.requestId, apiMediaRemoveAudioTrack(mediaId, id)) + makeNamedApiRequest(this.requestIdDelete, apiMediaRemoveAudioTrack(mediaId, id)) .onSuccess(() => { PagesController.ShowSnackBarRight(this.$t("Removed audio track") + ": " + aud.name); this.busyDeleting = false; @@ -465,7 +467,7 @@ export default defineComponent({ const mediaId = AppStatus.CurrentMedia; - makeNamedApiRequest(this.requestId, apiMediaRenameAudioTrack(mediaId, audioId, newId, newName)) + makeNamedApiRequest(this.requestIdRename, apiMediaRenameAudioTrack(mediaId, audioId, newId, newName)) .onSuccess(() => { PagesController.ShowSnackBarRight(this.$t("Renamed audio track") + ": " + newName + " (" + newId + ")"); this.audioRenameBusy = false; @@ -531,7 +533,9 @@ export default defineComponent({ }, beforeUnmount: function () { - abortNamedApiRequest(this.requestId); + abortNamedApiRequest(this.requestIdAdd); + abortNamedApiRequest(this.requestIdRename); + abortNamedApiRequest(this.requestIdDelete); }, }); diff --git a/frontend/src/components/player/editor/EditorSubtitles.vue b/frontend/src/components/player/editor/EditorSubtitles.vue index 2829c67..1cd76a8 100644 --- a/frontend/src/components/player/editor/EditorSubtitles.vue +++ b/frontend/src/components/player/editor/EditorSubtitles.vue @@ -162,7 +162,9 @@ export default defineComponent({ emits: ["changed"], setup() { return { - requestId: getUniqueStringId(), + requestIdAdd: getUniqueStringId(), + requestIdRename: getUniqueStringId(), + requestIdDelete: getUniqueStringId(), }; }, data: function () { @@ -269,7 +271,7 @@ export default defineComponent({ const mediaId = AppStatus.CurrentMedia; - makeNamedApiRequest(this.requestId, apiMediaSetSubtitles(mediaId, id, name, this.srtFile)) + makeNamedApiRequest(this.requestIdAdd, apiMediaSetSubtitles(mediaId, id, name, this.srtFile)) .onSuccess((res) => { PagesController.ShowSnackBarRight(this.$t("Added subtitles") + ": " + res.name); this.busy = false; @@ -349,7 +351,7 @@ export default defineComponent({ const mediaId = AppStatus.CurrentMedia; const id = sub.id; - makeNamedApiRequest(this.requestId, apiMediaRemoveSubtitles(mediaId, id)) + makeNamedApiRequest(this.requestIdDelete, apiMediaRemoveSubtitles(mediaId, id)) .onSuccess(() => { PagesController.ShowSnackBarRight(this.$t("Removed subtitles") + ": " + sub.name); this.busyDeleting = false; @@ -472,7 +474,7 @@ export default defineComponent({ const mediaId = AppStatus.CurrentMedia; - makeNamedApiRequest(this.requestId, apiMediaRenameSubtitles(mediaId, subtitleId, newId, newName)) + makeNamedApiRequest(this.requestIdRename, apiMediaRenameSubtitles(mediaId, subtitleId, newId, newName)) .onSuccess(() => { PagesController.ShowSnackBarRight(this.$t("Renamed subtitles") + ": " + newName + " (" + newId + ")"); this.subtitleRenameBusy = false; @@ -538,7 +540,9 @@ export default defineComponent({ }, beforeUnmount: function () { - abortNamedApiRequest(this.requestId); + abortNamedApiRequest(this.requestIdAdd); + abortNamedApiRequest(this.requestIdRename); + abortNamedApiRequest(this.requestIdDelete); }, });