Can't get configuration if the user's profile only has one device type
Opened this issue · 0 comments
remlap42 commented
If someone configures Phone for Chrome as the primary device on a user profile with no other devices configured, then the configuration of Phone for Chrome fails on login. A simple workaround is to add a secondary device -- SCA -- to the user's profile.
The problem is found in the getChromeDevice service function -- probably due to the fact that when only one device is found on the profile, BroadWorks doesn't return an array of objects?
service.getChromeDevice = function(){
var defer = $q.defer();
var apiName = '/profile/device';
console.log('inside getChromeDevice');
chrome.storage.local.get(function(storage){
$http.get($rootScope.xsp + '/com.broadsoft.xsi-actions/v2.0/user/' + $rootScope.username + apiName)
.success(function(response){
_.each(response.AccessDevices.accessDevice, function(device){
var deviceType = (typeof device.deviceType !== 'undefined') ? device.deviceType.$ : '';
if(deviceType === chromePhoneDeviceType){
defer.resolve(device);
}
});
}).error(function(error){
console.log(error);
defer.reject(error);
});
});