aboutsummaryrefslogtreecommitdiff
path: root/web/app/Application.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-17 12:35:16 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-17 12:35:16 +1300
commit843a370660646499c3007256be953506567f23fb (patch)
treebb912568b1dad621271a2016ba946634e8e93306 /web/app/Application.js
parent60343748265c7fdc228bc7078d2defb877bf66e1 (diff)
downloadtrackermap-server-843a370660646499c3007256be953506567f23fb.tar.gz
trackermap-server-843a370660646499c3007256be953506567f23fb.tar.bz2
trackermap-server-843a370660646499c3007256be953506567f23fb.zip
Add linking and unlinking of devices
Diffstat (limited to 'web/app/Application.js')
-rw-r--r--web/app/Application.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/web/app/Application.js b/web/app/Application.js
index e710b7ea2..83ca9e860 100644
--- a/web/app/Application.js
+++ b/web/app/Application.js
@@ -76,5 +76,24 @@ Ext.define('Traccar.Application', {
getPreference: function (key, defaultValue) {
return this.getUser().get(key) || this.getServer().get(key) || defaultValue;
+ },
+
+ getErrorHandler: function (scope, handler) {
+ return function (options, success, response) {
+ var result;
+ if (success) {
+ result = Ext.decode(response.responseText);
+ if (!result.success) {
+ Ext.Msg.alert(Strings.errorTitle, result.error);
+ }
+ handler.call(scope, options, success, response);
+ } else {
+ if (response.statusText) {
+ Ext.Msg.alert(Strings.errorTitle, response.statusText);
+ } else {
+ Ext.Msg.alert(Strings.errorTitle, response.status.toString()); // TODO: text message
+ }
+ }
+ }
}
});