HTTP codes for get_peer_role API call

master
Daniel Berteaud 10 years ago
parent f57cc57bb1
commit 642ebd1afc
  1. 8
      public/js/vroom.js
  2. 18
      vroom.pl

@ -707,7 +707,13 @@ function initVroom(room) {
})
},
error: function(data){
$.notify(locale.ERROR_OCCURRED, 'error');
data = data.responseJSON;
if (data.msg){
$.notify(data.msg, 'error');
}
else{
$.notify(locale.ERROR_OCCURRED, 'error');
}
},
success: function(data){
if (peers[id]){

@ -1690,7 +1690,25 @@ any '/api' => sub {
# Return the role of a peer
elsif ($req->{action} eq 'get_peer_role'){
my $peer_id = $req->{param}->{peer_id};
if (!$peer_id){
return $self->render(
json => {
msg => $self->l('ERROR_PEER_ID_MISSING'),
err => 'ERROR_PEER_ID_MISSING'
},
status => 400
);
}
my $role = $self->get_peer_role({room => $room->{name}, peer_id => $peer_id});
if (!$role){
return $self->render(
json => {
msg => $self->l('ERROR_PEER_NOT_FOUND'),
err => 'ERROR_PEER_NOT_FOUND'
},
status => 400
);
}
return $self->render(
json => {
role => $role,

Loading…
Cancel
Save