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 @@
<p>
<b-badge variant="light">Funding category (eg. for RTR):</b-badge>
<!-- TODO: discuss: should this be visible to show owners or only to administrators? -->
<span v-if="loaded.rtrcategory">
<span v-if="current.rtrcategory.length === 0"><small><i>(none set)</i></small></span>
<span v-else>{{ current.rtrcategory[0].rtrcategory }}</span>
<span v-if="loaded.fundingcategory">
<span v-if="current.fundingcategory.length === 0"><small><i>(none set)</i></small></span>
<span v-else>{{ current.fundingcategory[0].fundingcategory }}</span>
<img src="../assets/16x16/emblem-system.png" alt="edit" v-on:click="notYetImplemented" />
</span>
<span v-else><img src="../assets/radio.gif" height="24px" alt="loading data" /></span>
......@@ -284,7 +284,7 @@ export default {
languages: false,
topics: false,
musicfocus: false,
rtrcategory: false,
fundingcategory: false,
type: false
},
current: {
......@@ -293,7 +293,7 @@ export default {
languages: [],
topics: [],
musicfocus: [],
rtrcategory: [],
fundingcategory: [],
type: [],
note: {}
}
......@@ -342,7 +342,7 @@ export default {
this.loaded.hosts = false
this.loaded.languages = 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
this.currentShow = index
this.currentShowID = this.shows[this.currentShow].id
......@@ -451,7 +451,7 @@ export default {
this.loaded.categories = true
} else {
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,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(response => {
......@@ -491,7 +491,7 @@ export default {
this.loaded.languages = true
} else {
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,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(response => {
......@@ -511,7 +511,7 @@ export default {
this.loaded.topics = true
} else {
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,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(response => {
......@@ -531,7 +531,7 @@ export default {
this.loaded.musicfocus = true
} else {
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,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(response => {
......@@ -545,22 +545,22 @@ export default {
if (!loadingError) this.loaded.musicfocus = true
},
getRTRCategory: function () {
this.current.rtrcategory = []
this.current.fundingcategory = []
var loadingError = false
if (typeof this.shows[this.currentShow].rtrcategory !== 'number') {
this.loaded.rtrcategory = true
if (typeof this.shows[this.currentShow].fundingcategory !== 'number') {
this.loaded.fundingcategory = true
} 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,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(response => {
this.current.rtrcategory.push(response.data)
this.current.fundingcategory.push(response.data)
}).catch(error => {
loadingError = true
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 () {
this.current.type = []
......@@ -568,7 +568,7 @@ export default {
if (typeof this.shows[this.currentShow].type !== 'number') {
this.loaded.type = true
} 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,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).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