Verify the appstore details and register the cloudron with the store
This commit is contained in:
@@ -151,5 +151,20 @@ angular.module('Application').service('AppStore', ['$http', '$base64', 'Client',
|
||||
});
|
||||
};
|
||||
|
||||
AppStore.prototype.registerCloudron = function (token, userId, fqdn, callback) {
|
||||
if (Client.getConfig().apiServerOrigin === null) return callback(new AppStoreError(420, 'Enhance Your Calm'));
|
||||
|
||||
var data = {
|
||||
domain: fqdn
|
||||
};
|
||||
|
||||
$http.post(Client.getConfig().apiServerOrigin + '/api/v1/users/' + userId + '/cloudrons', data, { params: { accessToken: token }}).success(function (data, status) {
|
||||
if (status !== 201) return callback(new AppStoreError(status, data));
|
||||
return callback(null, data.cloudron);
|
||||
}).error(function (data, status) {
|
||||
return callback(new AppStoreError(status, data));
|
||||
});
|
||||
};
|
||||
|
||||
return new AppStore();
|
||||
}]);
|
||||
|
||||
Reference in New Issue
Block a user