signalpoint / jDrupal

A JavaScript Library and API for Drupal Applications
http://jdrupal.tylerfrankenstein.com/
GNU General Public License v2.0
76 stars 38 forks source link

Displaying response messages from Drupal 8 #72

Closed jsheffers closed 7 years ago

jsheffers commented 7 years ago

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?

signalpoint commented 7 years ago

@jsheffers It sounds like with your PR this issue is now closed?

jsheffers commented 7 years ago

Yep, closing.