Closed gmenih closed 6 years ago
Hi @gmenih341,
can I see the code on this line /manager.js:1675:10
?
Which version of Total.js + jComponent do you use? BTW: instead of $.components.GET()
use AJAX('GET /api/endpoint/', options, function(response) {
.
Thank you!
@petersirka The line 1675:10 is just console.trace()
, and just below it there's the GETSCHEMA
line I pasted above.
TotalJS version is 2.9.0, and I can't find jComponent being explicitly installed.
@gmenih341 please write me the whole exception.
There's no exception. It just calls the endpoint handler 4 times, and I get 408 status code on my api calls because of it.
But before the line below is something:
at endpoint_handler (/home/grega/Projects/Work/totaljs_project/controllers/manager.js:1675:10)
And I need to see it and send me the content .setQuery()
of Product schema.
I'm going to travel, so I will back around 3 hours.
You are missing parenthesis after self.callback
GETSCHEMA('Product').query(self.query, self.callback());
self.callback needs to be called because it returns a function depending on content type, so for json it will use self.json and for view self.view
@molda ah, thanks for that info. I thought there was an error in code, so I actually removed the parenthesis. This, however, still doesn't solve my issue :/
Try to replace self.callback() with a function:
GETSCHEMA('Product').query(self.query, function (err, response) {
console.log(err, response);
self.json(response);
});
Do you see the results in the console?
Yep, I see the console.log
being called multiple times.
Can you show us your controller??
Is there any news?
I recently started working on a project written in TotalJS.
I seem to have a weird issue, where an API call will call the endpoint up to 4 times. Here's how I call the endpoint:
The endpoint handler is pretty simple, it basically does this:
However, this gets called anywhere from 1 to 4 times. And the stack trace is always the same: