Wait backend method

Hello, I have an meteor app which conect with other app backend through ddp, and call a method, the problem is: I need to wait that backend method to stop and depending on the result route the client to other page, but the client don´t wait for the method, it make the call and then continues with the execution, I try to put a callback function in the call but don´t work either, something like this:
ddp.call(‘backendMethod’, params, callback(error ,result){
if(error){
show error
}else(){
route
}
})

but both error and result are undefined because, any ideas on this thanks

I’ve not used ddp.call yet, but I think it’s possible to wrap it in a Promise function

const ddpPromise = new Promise(function(resolve, reject) {
  ddp.call(‘backendMethod’, params, callback(error ,result){
    if (error) {
      reject(error);
    } else {
      resolve(result);
    }
  });
});

Then you can use that promise to “wait”