Skip to content
Snippets Groups Projects
Commit 4d4d7f90 authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

FIX: api trailing slashes and new fundingcategories

parent d4219005
No related branches found
No related tags found
No related merge requests found
...@@ -113,9 +113,9 @@ ...@@ -113,9 +113,9 @@
<p> <p>
<b-badge variant="light">Funding category (eg. for RTR):</b-badge> <b-badge variant="light">Funding category (eg. for RTR):</b-badge>
<!-- TODO: discuss: should this be visible to show owners or only to administrators? --> <!-- TODO: discuss: should this be visible to show owners or only to administrators? -->
<span v-if="loaded.rtrcategory"> <span v-if="loaded.fundingcategory">
<span v-if="current.rtrcategory.length === 0"><small><i>(none set)</i></small></span> <span v-if="current.fundingcategory.length === 0"><small><i>(none set)</i></small></span>
<span v-else>{{ current.rtrcategory[0].rtrcategory }}</span> <span v-else>{{ current.fundingcategory[0].fundingcategory }}</span>
<img src="../assets/16x16/emblem-system.png" alt="edit" v-on:click="notYetImplemented" /> <img src="../assets/16x16/emblem-system.png" alt="edit" v-on:click="notYetImplemented" />
</span> </span>
<span v-else><img src="../assets/radio.gif" height="24px" alt="loading data" /></span> <span v-else><img src="../assets/radio.gif" height="24px" alt="loading data" /></span>
...@@ -284,7 +284,7 @@ export default { ...@@ -284,7 +284,7 @@ export default {
languages: false, languages: false,
topics: false, topics: false,
musicfocus: false, musicfocus: false,
rtrcategory: false, fundingcategory: false,
type: false type: false
}, },
current: { current: {
...@@ -293,7 +293,7 @@ export default { ...@@ -293,7 +293,7 @@ export default {
languages: [], languages: [],
topics: [], topics: [],
musicfocus: [], musicfocus: [],
rtrcategory: [], fundingcategory: [],
type: [], type: [],
note: {} note: {}
} }
...@@ -342,7 +342,7 @@ export default { ...@@ -342,7 +342,7 @@ export default {
this.loaded.hosts = false this.loaded.hosts = false
this.loaded.languages = false this.loaded.languages = false
this.loaded.musicfocus = false this.loaded.musicfocus = false
this.loaded.rtrcategory = false this.loaded.fundingcategory = false
// set the current show and its ID to whatever we want to switch to now // set the current show and its ID to whatever we want to switch to now
this.currentShow = index this.currentShow = index
this.currentShowID = this.shows[this.currentShow].id this.currentShowID = this.shows[this.currentShow].id
...@@ -451,7 +451,7 @@ export default { ...@@ -451,7 +451,7 @@ export default {
this.loaded.categories = true this.loaded.categories = true
} else { } else {
for (var i in this.shows[this.currentShow].category) { for (var i in this.shows[this.currentShow].category) {
axios.get(process.env.API_STEERING + 'categories/' + this.shows[this.currentShow].category[i], { axios.get(process.env.API_STEERING + 'categories/' + this.shows[this.currentShow].category[i] + '/', {
withCredentials: true, withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token } headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(response => { }).then(response => {
...@@ -491,7 +491,7 @@ export default { ...@@ -491,7 +491,7 @@ export default {
this.loaded.languages = true this.loaded.languages = true
} else { } else {
for (var i in this.shows[this.currentShow].language) { for (var i in this.shows[this.currentShow].language) {
axios.get(process.env.API_STEERING + 'languages/' + this.shows[this.currentShow].language[i], { axios.get(process.env.API_STEERING + 'languages/' + this.shows[this.currentShow].language[i] + '/', {
withCredentials: true, withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token } headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(response => { }).then(response => {
...@@ -511,7 +511,7 @@ export default { ...@@ -511,7 +511,7 @@ export default {
this.loaded.topics = true this.loaded.topics = true
} else { } else {
for (var i in this.shows[this.currentShow].topic) { for (var i in this.shows[this.currentShow].topic) {
axios.get(process.env.API_STEERING + 'topics/' + this.shows[this.currentShow].topic[i], { axios.get(process.env.API_STEERING + 'topics/' + this.shows[this.currentShow].topic[i] + '/', {
withCredentials: true, withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token } headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(response => { }).then(response => {
...@@ -531,7 +531,7 @@ export default { ...@@ -531,7 +531,7 @@ export default {
this.loaded.musicfocus = true this.loaded.musicfocus = true
} else { } else {
for (var i in this.shows[this.currentShow].musicfocus) { for (var i in this.shows[this.currentShow].musicfocus) {
axios.get(process.env.API_STEERING + 'musicfocus/' + this.shows[this.currentShow].musicfocus[i], { axios.get(process.env.API_STEERING + 'musicfocus/' + this.shows[this.currentShow].musicfocus[i] + '/', {
withCredentials: true, withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token } headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(response => { }).then(response => {
...@@ -545,22 +545,22 @@ export default { ...@@ -545,22 +545,22 @@ export default {
if (!loadingError) this.loaded.musicfocus = true if (!loadingError) this.loaded.musicfocus = true
}, },
getRTRCategory: function () { getRTRCategory: function () {
this.current.rtrcategory = [] this.current.fundingcategory = []
var loadingError = false var loadingError = false
if (typeof this.shows[this.currentShow].rtrcategory !== 'number') { if (typeof this.shows[this.currentShow].fundingcategory !== 'number') {
this.loaded.rtrcategory = true this.loaded.fundingcategory = true
} else { } else {
axios.get(process.env.API_STEERING + 'rtrcategories/' + this.shows[this.currentShow].rtrcategory, { axios.get(process.env.API_STEERING + 'fundingcategories/' + this.shows[this.currentShow].fundingcategory + '/', {
withCredentials: true, withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token } headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(response => { }).then(response => {
this.current.rtrcategory.push(response.data) this.current.fundingcategory.push(response.data)
}).catch(error => { }).catch(error => {
loadingError = true loadingError = true
alert('There was an error fetching RTR category from the server: ' + error) alert('There was an error fetching RTR category from the server: ' + error)
}) })
} }
if (!loadingError) this.loaded.rtrcategory = true if (!loadingError) this.loaded.fundingcategory = true
}, },
getType: function () { getType: function () {
this.current.type = [] this.current.type = []
...@@ -568,7 +568,7 @@ export default { ...@@ -568,7 +568,7 @@ export default {
if (typeof this.shows[this.currentShow].type !== 'number') { if (typeof this.shows[this.currentShow].type !== 'number') {
this.loaded.type = true this.loaded.type = true
} else { } else {
axios.get(process.env.API_STEERING + 'types/' + this.shows[this.currentShow].type, { axios.get(process.env.API_STEERING + 'types/' + this.shows[this.currentShow].type + '/', {
withCredentials: true, withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token } headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(response => { }).then(response => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment