In offline mode, we need to wait for the org tree to be fetched or recreated
before we set the working location dropdown. This commit adds a function
to loop and wait for that to happen.
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Cesar Velez <cesar.velez@equinoxinitiative.org>
if (match) {
// requested WS registered on this client
+ $scope.workstation_obj = match;
$scope.workstation = match.id;
+ $scope.workstation_owner = match.owning_lib;
} else {
// the requested WS is not registered on this client
$scope.wsNotRegistered = true;
return check_digit;
}
+ function fetch_org_after_tree_exists () {
+ $timeout(function(){
+ try {
+ $scope.org = egCore.org.get($scope.current_workstation_owning_lib());
+ } catch(e) {
+ fetch_org_after_tree_exists();
+ }
+ },100);
+ }
+
+ fetch_org_after_tree_exists();
}
])