SavandBros / tiwun-awesome

Tiwun Awesome Application - Tiwun wear a frontend!
1 stars 0 forks source link

Recursive requests on API #11

Closed Alir3z4 closed 8 years ago

Alir3z4 commented 8 years ago

I get this on API when I visit http://localhost:9001/tags/product/

[05/Feb/2016 14:29:19] "OPTIONS /api/tags/product/?page=6 HTTP/1.1" 200 0
[05/Feb/2016 14:29:19] "OPTIONS /api/tags/product/?page=1 HTTP/1.1" 200 0
[05/Feb/2016 14:29:19] "OPTIONS /api/tags/product/?page=2 HTTP/1.1" 200 0
[05/Feb/2016 14:29:19] "OPTIONS /api/tags/product/?page=3 HTTP/1.1" 200 0
[05/Feb/2016 14:29:19] "OPTIONS /api/tags/product/?page=4 HTTP/1.1" 200 0
[05/Feb/2016 14:29:19] "OPTIONS /api/tags/product/?page=5 HTTP/1.1" 200 0
[05/Feb/2016 14:29:19] "OPTIONS /api/tags/product/?page=6 HTTP/1.1" 200 0
[05/Feb/2016 14:29:19] "OPTIONS /api/tags/product/?page=1 HTTP/1.1" 200 0
[05/Feb/2016 14:29:19] "OPTIONS /api/tags/product/?page=2 HTTP/1.1" 200 0
[05/Feb/2016 14:29:19] "OPTIONS /api/tags/product/?page=3 HTTP/1.1" 200 0
[05/Feb/2016 14:29:19] "OPTIONS /api/tags/product/?page=4 HTTP/1.1" 200 0
[05/Feb/2016 14:29:19] "OPTIONS /api/tags/product/?page=5 HTTP/1.1" 200 0
[05/Feb/2016 14:29:20] "GET /api/tags/product/?page=6 HTTP/1.1" 404 1721
[05/Feb/2016 14:29:21] "GET /api/tags/product/?page=3 HTTP/1.1" 404 1721
[05/Feb/2016 14:29:21] "GET /api/tags/product/?page=4 HTTP/1.1" 404 1721
[05/Feb/2016 14:29:22] "GET /api/tags/product/?page=4 HTTP/1.1" 404 1721
[05/Feb/2016 14:29:22] "GET /api/tags/product/?page=5 HTTP/1.1" 404 1721
[05/Feb/2016 14:29:23] "GET /api/tags/product/?page=5 HTTP/1.1" 404 1721
[05/Feb/2016 14:29:23] "GET /api/tags/product/?page=6 HTTP/1.1" 404 1721
[05/Feb/2016 14:29:24] "GET /api/tags/product/?page=1 HTTP/1.1" 200 583
[05/Feb/2016 14:29:25] "GET /api/tags/product/?page=1 HTTP/1.1" 200 583
[05/Feb/2016 14:29:25] "GET /api/tags/product/?page=2 HTTP/1.1" 404 1721
[05/Feb/2016 14:29:26] "GET /api/tags/product/?page=2 HTTP/1.1" 404 1721
[05/Feb/2016 14:29:26] "GET /api/tags/product/?page=3 HTTP/1.1" 404 1721
AmirSavand commented 8 years ago

That's because it loads first 5 pages due to item count for each page is 5 which is less than what it should be.

AmirSavand commented 8 years ago

Also the fact that it is duplicated is because all controllers load twice.

Alir3z4 commented 8 years ago

That's because it loads first 5 pages due to item count for each page is 5 which is less than what it should be.

It shouldn't do that. We don't need to load 5 first pages.

To load more items on each API call, you can just make an task on backend issue tracker and that's we'll get start working on it. Each API calls will costs us badly.

Also the fact that it is duplicated is because all controllers load twice.

AngularJS does OPTIONS request, to know more about it:

AmirSavand commented 8 years ago

Fixed completely.