query box status via apiServerOrigin otherwise we hit nxdomain

This commit is contained in:
Girish Ramakrishnan
2016-07-06 16:26:40 -05:00
parent 44e7d87aac
commit 9ad4e61b87

View File

@@ -41,9 +41,10 @@ app.controller('Controller', ['$scope', '$http', '$interval', function ($scope,
if (!data.migrate.info) return;
// check if the new domain is available. only works for valid ca-certs
$http.get('https://my.' + data.migrate.info.domain + '/api/v1/cloudron/status').success(function(data, status) {
if (status === 200) return window.location = 'https://my.' + data.migrate.info.domain;
// check if the new domain is available via the appstore (cannot use cloudron
// directly as we might hit NXDOMAIN)
$http.get(data.apiServerOrigin + '/api/v1/boxes/' + data.migrate.info.domain + '/status').success(function(data, status) {
if (status === 200 && data.status === 'ready') return window.location = 'https://my.' + data.migrate.info.domain;
});
}
}