Fix error handling for lock/unlock

master
Daniel Berteaud 11 years ago
parent dec8da6a44
commit 96d8a0eaa6
  1. 8
      public/js/vroom.js
  2. 3
      public/vroom.pl

@ -580,10 +580,10 @@ function initVroom(room) {
room: roomName room: roomName
}, },
error: function(data) { error: function(data) {
var msg = (data && data.msg) ? data.msg : locale.ERROR_OCCURED; $.notify(locale.ERROR_OCCURED, 'error');
$.notify(msg, 'error');
}, },
success: function(data) { success: function(data) {
if (data.status == 'success'){
$.notify(data.msg, 'info'); $.notify(data.msg, 'info');
if (action === 'lock'){ if (action === 'lock'){
$("#lockLabel").addClass('btn-danger'); $("#lockLabel").addClass('btn-danger');
@ -594,6 +594,10 @@ function initVroom(room) {
webrtc.sendToAll('room_unlocked', {}); webrtc.sendToAll('room_unlocked', {});
} }
} }
else{
$.notify(data.msg, 'error');
}
}
}); });
}); });

@ -518,13 +518,14 @@ post '/action' => sub {
return $self->render( return $self->render(
json => { json => {
msg => $self->l('ERROR_OCCURED'), msg => $self->l('ERROR_OCCURED'),
status => 'error'
}, },
status => '500'
); );
} }
return $self->render( return $self->render(
json => { json => {
msg => $success, msg => $success,
status => 'success'
} }
); );
} }

Loading…
Cancel
Save