diff options
Diffstat (limited to 'web/app/view/user/UserDialogController.js')
-rw-r--r-- | web/app/view/user/UserDialogController.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/web/app/view/user/UserDialogController.js b/web/app/view/user/UserDialogController.js index 4c6b6c42f..1ec14c5e8 100644 --- a/web/app/view/user/UserDialogController.js +++ b/web/app/view/user/UserDialogController.js @@ -21,7 +21,21 @@ Ext.define('Traccar.view.user.UserDialogController', { onSaveClick: function(button) { var dialog = button.up('window').down('form'); dialog.updateRecord(); - dialog.getRecord().save(); + var record = dialog.getRecord(); + if (record === Traccar.getApplication().getUser()) { + record.save(); + } else { + var store = Ext.getStore('Users'); + if (record.phantom) { + store.add(record); + } + store.sync({ + failure: function(batch) { + store.rejectChanges(); // TODO + Traccar.ErrorManager.check(true, batch.exceptions[0].getResponse()); + } + }); + } button.up('window').close(); }, |