hasura / js-sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hasura Auth code change

AjaSharma93 opened this issue · comments

The success and error callbacks of the Hasura Auth class don't return the corresponding success and error messages with status code. The messages are just printed on the console. The Data class on the other hand does return the corresponding messages but no status code.

@AjaSharma93 Got it. Can you show us a specific example that you came across? We can fix this asap. Is this happening just for errors?

I'm looking at the source code and can confirm I don't receive the error message in the callback for hasura.auth.signup(...)

Line 41 of Auth.js:
onSuccess();

Lines 44 and 45 of Auth.js
console.log(r); onError();

There are similar lines in Data.js for the query functions, for example,

Lines 21 to 28 of Data.js:
(result) => { onSuccess(result); }, (e) => { logError(e); onError(e); });

In the above, you actually send the data and the error message in the callbacks. Why is it different in Auth.js?

Example from my app:
hasura.setUsername($('#user').val());
hasura.user.email= $("#email").val();
hasura.auth.signup($('#pwd').val(),{}, (success)=>{
//redirecting to welcome page
}, (err)=>{
alert(err); // err doesn't provide a error message
});