Merge branch 'fix/now-really-fix-error-message-reporting' into 'marietje-zuid'

fix(queues): now really fix the request notifications

Closes #82

See merge request technicie/MarietjeDjango!91
This commit is contained in:
2024-03-05 13:25:13 +01:00
2 changed files with 2 additions and 4 deletions

View File

@ -163,7 +163,7 @@ class QueueRequestAPIView(CreateAPIView):
try: try:
playlist_song = queue.request(song, request.user) playlist_song = queue.request(song, request.user)
except RequestException as e: except RequestException as e:
return Response(data={"success": False, "errorMessage": str(e)}) return Response(status=403, data={"success": False, "errorMessage": str(e)})
request_counter.labels(queue=queue.name).inc() request_counter.labels(queue=queue.name).inc()
return Response(status=200, data=self.serializer_class(playlist_song).data) return Response(status=200, data=self.serializer_class(playlist_song).data)

View File

@ -594,8 +594,7 @@
"Content-Type": 'application/json', "Content-Type": 'application/json',
}, },
}).then(response => { }).then(response => {
// TODO: Communicate failure through HTTP error codes (403) instead of checking response.success. if (response.status === 200) {
if (response.status === 200 && response.success) {
return response.json(); return response.json();
} else { } else {
throw response; throw response;
@ -612,7 +611,6 @@
tata.error('', "An unknown exception occurred.") tata.error('', "An unknown exception occurred.")
} }
}); });
queue_vue.refresh();
}, },
report_song(song_id) { report_song(song_id) {