Uncaught (in promise) TypeError: r is not a function
FlameFractal opened this issue · comments
Vishal Gauba commented
Tanmai Gopal commented
onSuccess
andonError
are functions that you should define.- A
}
is missing after theargs
brace is closed.
Option 1
Use lambdas or anonymous functions directly for handling success/error.
hasura.data.query({
type: 'select',
args: {
table: 'article',
columns: ['*']
}},
(data) => { console.log(data); },
(error) => { console.log(error); }
);
Option 2:
Use predefined functions
function mySuccessHandler (data) {
console.log(data);
}
function myErrorHandler (e) {
console.log(e);
}
hasura.data.query({
type: 'select',
args: {
table: 'article',
columns: ['*']
}},
mySuccessHandler,
myErrorHandler
);
Jaison Titus commented
@coco98 I think the } is missing in the docs as well.
Tanmai Gopal commented
@jaisontj Fixed!
@FlameFractal Did this work for you?