diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-02-05 15:29:13 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-02-05 15:29:13 +0100 |
commit | 77fccf6e1eaa3d4f0b589760f1644aa09b48d009 (patch) | |
tree | a757ebc50ff47347a0a78b14025ab1aeadf50c37 /js/app | |
parent | 55fc1e6c1fa7b3ef91f5b5736b69bdae34609f24 (diff) |
move messages out of function creation
Diffstat (limited to 'js/app')
-rw-r--r-- | js/app/Config.js | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/js/app/Config.js b/js/app/Config.js index 40a112a93..4c598e00d 100644 --- a/js/app/Config.js +++ b/js/app/Config.js @@ -44,30 +44,28 @@ app.config(function ($routeProvider, $provide, $httpProvider) { } }; }); + var errorMessages = { + 0: t('news', 'Request failed, network connection unavailable!'), + 401: t('news', 'Request unauthorized. Are you logged in?'), + 403: t('news', 'Request forbidden. Are you an admin?'), + 412: t('news', 'Token expired or app not enabled! Reload the page!'), + 500: t('news', 'Internal server error! Please check your ' + + 'data/owncloud.log file for additional ' + + 'information!'), + 503: t('news', 'Request failed, ownCloud is in currently ' + + 'in maintenance mode!'), + }; $provide.factory('ConnectionErrorInterceptor', function ($q, $timeout) { var timer; return { responseError: function (response) { - var messages = { - 0: t('news', 'Request failed, network connection ' + - 'unavailable!'), - 401: t('news', 'Request unauthorized. Are you logged in?'), - 403: t('news', 'Request forbidden. Are you an admin?'), - 412: t('news', 'Token expired or app not enabled! ' + - 'Try to reload the page!'), - 500: t('news', 'Internal server error! Please check your ' + - 'data/owncloud.log file for additional ' + - 'information!'), - 503: t('news', 'Request failed, ownCloud is in currently ' + - 'in maintenance mode!'), - }; // status 0 is a network error - if (response.status in messages) { + if (response.status in errorMessages) { if (timer) { $timeout.cancel(timer); } OC.Notification.hide(); - OC.Notification.showHtml(messages[response.status]); + OC.Notification.showHtml(errorMessages[response.status]); timer = $timeout(function () { OC.Notification.hide(); }, 5000); |