ExLibrisGroup/primo-explore-devenv

How to route to account details.

Closed this issue · 4 comments

I have hooked prmRequestServicesAfter with a component with a custom controller. The idea is that if a user is coming from a browser within our own network (not yet implemented) and is also in the "OFFSITE" user group, then we need to ask them to provide their postal address and phone, and then come up to the desk. Is their any way to use $location or ng-link to route them to personal details?

My current controller code works, but it causes a full page reload. Also, unlike "Sign-in", navigation back to the search results is not quite available. Capturing item information might be useful.

app.controller('RequestServicesAfterController', [
  '$scope',
  '$location',
  function($scope, $location) {
    var sessionManagerService = this.parentCtrl.userSessionManagerService;
    this.needsUpgrade = function() {
      var token = sessionManagerService.jwtUtilService.getDecodedToken();
      if (token === undefined) {
        return false;
      }
      return token.userGroup == 'OFFSITE';
    };
    this.toAccountDetails = function() {
      console.log('route to account personal details');
      // $location.path('/discovery/account?vid=01NLM_INST:DAN1&section=personal_details');
      var vid = new URLSearchParams(location.search).get('vid');
      var newurl = '/discovery/account?vid='+vid+'&section=personal_details';
      location.href = newurl;
    }
  }
]);

Also see #134 - this is hard to debug. I need to change the code that returns "true" with the usergroup is "OFFSITE" to return true all the time.

Hey @danizen,

You might want to try experimenting with the UI-Router $state service. Something like this might work:

$state.go('account', {vid: appConfig.vid, lang: 'en_US', section: 'personal_details'});

Here are a couple usage examples from our customization package:

You can find documentation on the $state service here. (Note: Primo uses version 0.3.2.)

Also, there's a mostly-up-to-date list of Primo view states and associated parameters in this Google doc.

--
Jeff

Thanks for the response - I will check it out.

I'm going to close this as we are satisfied with our current solution.