Fix error handling for lock/unlock

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

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

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

Loading…
Cancel
Save