node.js - aurelia-fetch-client - a promise was rejected with a non-error: [object Response] -


i'm using aurelia-fetch-client , error when send request nodejs backend api:

warning: promise rejected non-error: [object response]     @ http://localhost:9000/scripts/vendor-bundle.js:39700:20     @ array.reduce (native)     @ applyinterceptors (http://localhost:9000/scripts/vendor-bundle.js:39696:33)     @ processresponse (http://localhost:9000/scripts/vendor-bundle.js:39688:12)     @ http://localhost:9000/scripts/vendor-bundle.js:39603:18 previous event:     @ http://localhost:9000/scripts/vendor-bundle.js:39602:24 previous event:     @ httpclient.<anonymous> (http://localhost:9000/scripts/vendor-bundle.js:39590:64)     @ httpclient.fetch (http://localhost:9000/scripts/vendor-bundle.js:39574:23)     @ authservice.login (http://localhost:9000/scripts/app-bundle.js:126:30)     @ login.login (http://localhost:9000/scripts/app-bundle.js:190:30)     @ callscope.evaluate (http://localhost:9000/scripts/vendor-bundle.js:24067:21)     @ listener.callsource (http://localhost:9000/scripts/vendor-bundle.js:27508:42)     @ http://localhost:9000/scripts/vendor-bundle.js:27532:24     @ htmldocument.handledelegatedevent (http://localhost:9000/scripts/vendor-bundle.js:25721:11) 

everything works fine warning annoying , have no idea how fix it, here's code sends request:

import {httpclient, json} 'aurelia-fetch-client'; import baseconfig 'config';  export class authservice {     constructor() {         this.http = new httpclient().configure(config => {             config                 .withbaseurl(baseconfig.baseurl)                 .usestandardconfiguration();         });          this.isauthenticated = false;     }      login(credentials) {         return this.http.fetch('/login', {             method: 'post',             body: json(credentials)         })             .then(res => {                 this.savetoken(res.token)                 return promise.resolve();             });     }      savetoken(token) {         localstorage.setitem('token', token);         this.isauthenticated = true;     } } 

any appreciated

the aurelia-fetch-client standard configuration (applied in code via .usestandardconfiguration()) rejects on non-success http response status codes. there recent (closed) issue in aurelia/fetch-client repo here. fetch client rejecting promise response itself, , browser complaining (it wants promises rejected instances of error).

i addressed in own code removing .usestandardconfiguration(), don't need in particular project. can check out the source code more of picture of what's going on configuration.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -