Skip to content

Commit

Permalink
Frontend: Use different request Ids for subtitles and audios
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinSRG committed Oct 13, 2024
1 parent 7f4152e commit f54aa0e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
14 changes: 9 additions & 5 deletions frontend/src/components/player/editor/EditorAudios.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ export default defineComponent({
emits: ["changed"],
setup() {
return {
requestId: getUniqueStringId(),
requestIdAdd: getUniqueStringId(),
requestIdRename: getUniqueStringId(),
requestIdDelete: getUniqueStringId(),
};
},
data: function () {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -531,7 +533,9 @@ export default defineComponent({
},
beforeUnmount: function () {
abortNamedApiRequest(this.requestId);
abortNamedApiRequest(this.requestIdAdd);
abortNamedApiRequest(this.requestIdRename);
abortNamedApiRequest(this.requestIdDelete);
},
});
</script>
14 changes: 9 additions & 5 deletions frontend/src/components/player/editor/EditorSubtitles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ export default defineComponent({
emits: ["changed"],
setup() {
return {
requestId: getUniqueStringId(),
requestIdAdd: getUniqueStringId(),
requestIdRename: getUniqueStringId(),
requestIdDelete: getUniqueStringId(),
};
},
data: function () {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -538,7 +540,9 @@ export default defineComponent({
},
beforeUnmount: function () {
abortNamedApiRequest(this.requestId);
abortNamedApiRequest(this.requestIdAdd);
abortNamedApiRequest(this.requestIdRename);
abortNamedApiRequest(this.requestIdDelete);
},
});
</script>

0 comments on commit f54aa0e

Please sign in to comment.