mirror of
https://github.com/Foltik/Shimapan
synced 2024-12-04 19:32:20 -05:00
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
const angular = require('angular');
|
|
|
|
angular.module('StatSvc', []).service('StatService', ['$http', function($http) {
|
|
this.getUploads = async () => {
|
|
const res = await $http({
|
|
method: 'GET',
|
|
url: '/api/stats/uploads'
|
|
});
|
|
|
|
return res.data;
|
|
};
|
|
|
|
this.getUploadsWeek = async () => {
|
|
let oneWeekAgo = new Date();
|
|
oneWeekAgo.setDate(oneWeekAgo.getDate() - 7);
|
|
|
|
const res = await $http({
|
|
method: 'GET',
|
|
url: '/api/stats/uploads',
|
|
data: {
|
|
after: oneWeekAgo
|
|
}
|
|
});
|
|
|
|
return res.data;
|
|
};
|
|
|
|
this.getViews = async () => {
|
|
const res = await $http({
|
|
method: 'GET',
|
|
url: '/api/stats/views'
|
|
});
|
|
|
|
return res.data;
|
|
};
|
|
|
|
this.getViewsWeek = async () => {
|
|
let oneWeekAgo = new Date();
|
|
oneWeekAgo.setDate(oneWeekAgo.getDate() - 7);
|
|
|
|
const res = await $http({
|
|
method: 'GET',
|
|
url: '/api/stats/uploads'
|
|
});
|
|
|
|
return res.data;
|
|
};
|
|
}]);
|