On promise rejection jDrupal uses the Error() object and returns back req.statusText which in the case of bad login credentials returns "Bad request". This makes it impossible to actually output to the user the message from Drupal, which is "Sorry, unrecognized username or password".
The only way I can get this to work is to change the rejection of the promise to look like this by removing Error() and returning the entire response instead of just statusText.
My fix
reject(req);
Current jDrupal example
reject(Error(req.statusText));
Am I going about this the wrong way? Is there another way to achieve this?
On promise rejection jDrupal uses the
Error()
object and returns backreq.statusText
which in the case of bad login credentials returns "Bad request". This makes it impossible to actually output to the user the message from Drupal, which is"Sorry, unrecognized username or password"
.The only way I can get this to work is to change the rejection of the promise to look like this by removing
Error()
and returning the entire response instead of just statusText.My fix
Current jDrupal example
Am I going about this the wrong way? Is there another way to achieve this?