Skip to content
Snippets Groups Projects
Commit 4e73af9e authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :koala:
Browse files

refactor: remove remaining uses of nested steering api endpoints

parent f3dd0f91
No related branches found
No related tags found
No related merge requests found
......@@ -402,7 +402,6 @@ export default {
loadScheduleTimeslots(scheduleId) {
this.$store.dispatch('shows/fetchTimeslots', {
id: this.selectedShow.id,
scheduleId,
start: this.schedule.firstDate,
end: this.schedule.lastDate,
......
......@@ -173,7 +173,7 @@ const mutations = {
const actions = {
fetchSchedule(ctx, data) {
ctx.commit('loading', 'schedule')
const uri = createSteeringURL('shows', data.showId, 'schedules', data.scheduleId)
const uri = createSteeringURL('schedules', data.scheduleId)
axios
.get(uri)
.then((response) => {
......@@ -193,7 +193,9 @@ const actions = {
fetchSchedules(ctx, data) {
ctx.commit('loading', 'schedule')
const uri = createSteeringURL('shows', data.showId, 'schedules')
const query = new URLSearchParams()
if (data.showId) query.set('showIds', data.showId)
const uri = createSteeringURL('schedules', query)
axios
.get(uri)
.then((response) => {
......@@ -233,12 +235,10 @@ const actions = {
if (has(data, 'offset')) query.set('offset', data.offset)
}
const uri =
data.id && data.scheduleId
? createSteeringURL('shows', data.id, 'schedules', data.scheduleId, 'timeslots', query)
: data.id
? createSteeringURL('shows', data.id, 'timeslots', query)
: createSteeringURL('timeslots', query)
if (data.id) query.set('showIds', data.id)
if (data.scheduleId) query.set('scheduleIds', data.scheduleId)
const uri = createSteeringURL('timeslots', query)
axios
.get(uri)
......@@ -292,7 +292,8 @@ const actions = {
submitSchedule(ctx, data) {
ctx.commit('loading', 'schedules')
const uri = createSteeringURL('shows', data.showId, 'schedules')
const uri = createSteeringURL('schedules')
data.schedule.showId = data.showId
return axios
.post(uri, data.schedule)
.then((response) => {
......@@ -366,14 +367,7 @@ const actions = {
},
updateTimeslot(ctx, data) {
const uri = createSteeringURL(
'shows',
data.showId,
'schedules',
data.scheduleId,
'timeslots',
data.timeslot.id,
)
const uri = createSteeringURL('timeslots', data.timeslot.id)
axios
.put(uri, data.timeslot)
.then(() => {
......@@ -391,7 +385,7 @@ const actions = {
},
deleteSchedule(ctx, data) {
const uri = createSteeringURL('shows', data.showId, 'schedules', data.scheduleId)
const uri = createSteeringURL('schedules', data.scheduleId)
axios
.delete(uri)
.then(() => {
......@@ -408,14 +402,7 @@ const actions = {
},
deleteTimeslot(ctx, data) {
const uri = createSteeringURL(
'shows',
data.showId,
'schedules',
data.scheduleId,
'timeslots',
data.timeslotId,
)
const uri = createSteeringURL('timeslots', data.timeslotId)
axios
.delete(uri)
.then(() => {
......
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