Skip to content

Commit

Permalink
Feat: Differentiate between upload new chapters
Browse files Browse the repository at this point in the history
and replacing existing ones #46, #97
  • Loading branch information
Letty committed Jan 26, 2020
1 parent be98ace commit b9ade92
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions components/EpisodeChapters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h2 class="title is-size-5 r_episode-chapters__headline">
Chapter Marks
</h2>
<div v-if="activeAudioChapters">
<div v-if="activeAudioChapters.length !== 0">
<b-upload
:state="chapterMarksState"
:type="'FILE'"
Expand Down Expand Up @@ -153,10 +153,23 @@ export default {
// console.log(evt)
},
convertChapterFile(evt) {
// console.log(evt.target.result)
if (this.activeAudioChapters.length !== 0) {
this.$store
.dispatch('audio/deleteAudioChapters', {
chapters: this.activeAudioChapters,
audio_id: this.activeAudio.id
})
.then(result => {
this.convertChapters(evt.target.result)
})
} else {
this.convertChapters(evt.target.result)
}
},
convertChapters(file) {
this.$store
.dispatch('audio/convertAudioChapters', {
file: evt.target.result,
file: file,
audio_id: this.activeAudio.id
})
.then(result => {
Expand Down

0 comments on commit b9ade92

Please sign in to comment.