Call the new setDnsRecords route

This commit is contained in:
Girish Ramakrishnan
2018-07-25 10:51:58 -07:00
parent 91ecab08da
commit be86a3022f
2 changed files with 14 additions and 9 deletions
+8 -8
View File
@@ -1329,13 +1329,6 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N
}).error(defaultErrorHandler(callback)); // this doesn't call defaultErrorHandler till we fix domains code to use this directly
};
Client.prototype.updateMailDomain = function (domain, callback) {
post('/api/v1/mail/' + domain, { }).success(function (data, status) {
if (status !== 202) return callback(new ClientError(status, data));
callback(null);
}).error(defaultErrorHandler(callback)); // this doesn't call defaultErrorHandler till we fix domains code to use this directly
};
Client.prototype.addDomain = function (domain, zoneName, provider, config, fallbackCertificate, tlsConfig, callback) {
var data = {
domain: domain,
@@ -1370,7 +1363,7 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N
put('/api/v1/domains/' + domain, data).success(function (data, status) {
if (status !== 204) return callback(new ClientError(status, data));
that.updateMailDomain(domain, callback); // this is done so that an out-of-sync dkim key can be synced
that.setDnsRecords(domain, callback); // this is done so that an out-of-sync dkim key can be synced
}).error(defaultErrorHandler(callback));
};
@@ -1424,6 +1417,13 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N
}).error(defaultErrorHandler(callback));
};
Client.prototype.setDnsRecords = function (domain, callback) {
post('/api/v1/mail/' + domain + '/dns', { }).success(function (data, status) {
if (status !== 201) return callback(new ClientError(status, data));
callback(null);
}).error(defaultErrorHandler(callback));
};
Client.prototype.getMailStatusForDomain = function (domain, callback) {
get('/api/v1/mail/' + domain + '/status').success(function (data, status) {
if (status !== 200 || typeof data !== 'object') return callback(new ClientError(status, data));
+6 -1
View File
@@ -204,7 +204,12 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
Client.enableMailForDomain($scope.selectedDomain.domain, true , function (error) {
if (error) return console.error(error);
$scope.refreshDomain();
Client.setDnsRecords($scope.selectedDomain.domain, function (error) {
if (error) return console.error(error);
$scope.refreshDomain();
});
});
};