summaryrefslogtreecommitdiffstats
path: root/js/app/Config.js
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-21 23:43:28 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-21 23:43:28 +0200
commit0fa67552247b2d29a6ca438c2605b8db2bbdbab7 (patch)
tree8109135e2fc141a324e8f21c66243ee4277b3b7c /js/app/Config.js
parentd3a774b2bd79654360a3ef12618102abf85a2ce3 (diff)
es6 all the things
Diffstat (limited to 'js/app/Config.js')
-rw-r--r--js/app/Config.js25
1 files changed, 10 insertions, 15 deletions
diff --git a/js/app/Config.js b/js/app/Config.js
index 5581af0e4..bd38f897b 100644
--- a/js/app/Config.js
+++ b/js/app/Config.js
@@ -9,10 +9,8 @@
*/
app.config(function ($routeProvider, $provide, $httpProvider) {
'use strict';
- var getResolve,
- feedType;
- feedType = {
+ let feedType = {
FEED: 0,
FOLDER: 1,
STARRED: 2,
@@ -21,17 +19,17 @@ app.config(function ($routeProvider, $provide, $httpProvider) {
};
// constants
- $provide.constant('REFRESH_RATE', 60); // seconds, how often feeds and folders shoudl be refreshed
+ $provide.constant('REFRESH_RATE', 60); // seconds
$provide.constant('ITEM_BATCH_SIZE', 50); // how many items to autopage by
$provide.constant('BASE_URL', OC.generateUrl('/apps/news'));
$provide.constant('FEED_TYPE', feedType);
// make sure that the CSRF header is only sent to the ownCloud domain
- $provide.factory('CSRFInterceptor', function ($q, BASE_URL) {
+ $provide.factory('CSRFInterceptor', ($q, BASE_URL) => {
return {
- request: function (config) {
+ request: (config) => {
if (config.url.indexOf(BASE_URL) === 0) {
- config.headers.requesttoken = oc_requesttoken;
+ config.headers.requesttoken = csrfToken;
}
return config || $q.when(config);
@@ -41,7 +39,7 @@ app.config(function ($routeProvider, $provide, $httpProvider) {
$httpProvider.interceptors.push('CSRFInterceptor');
// routing
- getResolve = function (type) {
+ let getResolve = (type) => {
return {
// request to items also returns feeds
data: [
@@ -50,12 +48,9 @@ app.config(function ($routeProvider, $provide, $httpProvider) {
'$q',
'BASE_URL',
'ITEM_BATCH_SIZE',
- function ($http, $route, $q, BASE_URL, ITEM_BATCH_SIZE) {
+ ($http, $route, $q, BASE_URL, ITEM_BATCH_SIZE) => {
- var parameters,
- deferred;
-
- parameters = {
+ let parameters = {
type: type,
limit: ITEM_BATCH_SIZE
};
@@ -64,13 +59,13 @@ app.config(function ($routeProvider, $provide, $httpProvider) {
parameters.id = $route.current.params.id;
}
- deferred = $q.defer();
+ let deferred = $q.defer();
$http({
url: BASE_URL + '/items',
method: 'GET',
params: parameters
- }).success(function (data) {
+ }).success((data) => {
deferred.resolve(data);
});