1
|
/**
|
2
|
* Created by sandro on 6/19/15.
|
3
|
*/
|
4
|
|
5
|
|
6
|
|
7
|
dliApp.factory('queryService', ['$http', function($http){
|
8
|
|
9
|
var factory={}
|
10
|
|
11
|
|
12
|
factory.query=function(query, page) {
|
13
|
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
|
14
|
if (page == null)
|
15
|
return $http.post('/api/post/', $.param( { 'action' : "query", 'query':query }));
|
16
|
else
|
17
|
return $http.post('/api/post/', $.param( { 'action' : "query", 'query':query, 'start':(page-1)*10 }));
|
18
|
}
|
19
|
|
20
|
|
21
|
factory.getStatsDetail = function () {
|
22
|
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
|
23
|
return $http.post('/api/stats_detail/');
|
24
|
}
|
25
|
|
26
|
factory.getStats = function () {
|
27
|
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
|
28
|
return $http.post('/api/stats/');
|
29
|
}
|
30
|
|
31
|
|
32
|
|
33
|
factory.getItem= function (identifier) {
|
34
|
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
|
35
|
return $http.post('/api/item/'+identifier);
|
36
|
}
|
37
|
|
38
|
return factory;
|
39
|
}]);
|