Commit 0171a1b3 authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

refactoring

parent a9f27418
......@@ -251,7 +251,7 @@ export default {
withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token },
}).then(
this.fetchShows(this.shows[this.currentShow].slug)
this.fetchFiles(this.shows[this.currentShow].slug)
).catch(error => {
console.log('Error:')
console.log(error)
......@@ -266,7 +266,7 @@ export default {
withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(
this.fetchShows(this.shows[this.currentShow].slug)
this.fetchFiles(this.shows[this.currentShow].slug)
).catch(error => {
console.log('Error:')
console.log(error)
......@@ -279,7 +279,7 @@ export default {
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(response => {
this.startUpload(response.data.id)
this.fetchShows(this.shows[this.currentShow].slug)
this.fetchFiles(this.shows[this.currentShow].slug)
}).catch(error => {
console.log('Error:')
console.log(error)
......@@ -344,7 +344,7 @@ export default {
// set the current show and its ID to whatever we want to switch to now
this.currentShow = index
this.currentShowID = this.shows[this.currentShow].id
this.fetchShows(this.shows[this.currentShow].slug)
this.fetchShow(this.shows[this.currentShow].slug)
},
switchMode: function (mode) {
if (this.mode !== mode) {
......@@ -355,9 +355,12 @@ export default {
}
}
},
fetchShows: function (slug) {
fetchShow: function (slug) {
this.fetchFiles(slug)
this.fetchPlaylists(slug)
},
fetchFiles: function (slug) {
this.loaded.files = false
this.loaded.playlists = false
var uri = process.env.VUE_APP_API_TANK + 'shows/' + slug + '/files'
axios.get(uri, {
withCredentials: true,
......@@ -370,7 +373,10 @@ export default {
}).catch(error => {
alert('There was an error fetching files from tank: ' + error)
})
uri = process.env.VUE_APP_API_TANK + 'shows/' + slug + '/playlists'
},
fetchPlaylists: function (slug) {
this.loaded.playlists = false
var uri = process.env.VUE_APP_API_TANK + 'shows/' + slug + '/playlists'
axios.get(uri, {
withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment