Show More
@@ -35,45 +35,28 function($, utils) { | |||
|
35 | 35 | }; |
|
36 | 36 | |
|
37 | 37 | ConfigSection.prototype.load = function() { |
|
38 | var p = new Promise(function(resolve, reject) { | |
|
39 | $.ajax(this.api_url(), { | |
|
38 | return utils.promising_ajax(this.api_url(), { | |
|
40 | 39 |
|
|
41 | 40 |
|
|
42 | 41 |
|
|
43 | success: function(data, status, jqXHR) { | |
|
42 | }).then(function(data) { | |
|
44 | 43 |
|
|
45 | 44 |
|
|
46 |
|
|
|
47 | }, | |
|
48 | error: function(jqXHR, status, error) { | |
|
49 | // Should never happen; mark as loaded so things don't keep | |
|
50 | // waiting. | |
|
51 | this._load_done(); | |
|
52 | utils.log_ajax_error(jqXHR, status, error); | |
|
53 | reject(utils.wrap_ajax_error(jqXHR, status, error)); | |
|
54 | } | |
|
55 | }); | |
|
45 | return data; | |
|
56 | 46 | }); |
|
57 | 47 | }; |
|
58 | 48 | |
|
59 | 49 | ConfigSection.prototype.update = function(newdata) { |
|
60 | return new Promise(function(resolve, reject) { | |
|
61 | $.ajax(this.api_url(), { | |
|
50 | return utils.promising_ajax(this.api_url(), { | |
|
62 | 51 |
|
|
63 | 52 |
|
|
64 | 53 |
|
|
65 | 54 |
|
|
66 | 55 |
|
|
67 | success: function(data, status, jqXHR) { | |
|
56 | }).then(function(data) { | |
|
68 | 57 |
|
|
69 | 58 |
|
|
70 |
|
|
|
71 | }, | |
|
72 | error: function(jqXHR, status, error) { | |
|
73 | utils.log_ajax_error(jqXHR, status, error); | |
|
74 | reject(utils.wrap_ajax_error(jqXHR, status, error)); | |
|
75 | } | |
|
76 | }); | |
|
59 | return data; | |
|
77 | 60 | }); |
|
78 | 61 | }; |
|
79 | 62 |
General Comments 0
You need to be logged in to leave comments.
Login now