dimanche 4 mars 2018

transition from ember service in Ember.js

generateDeviceCode(response) {
  let {
      encryptedactivationmessage,
      macvalueactivationmessage,
      encryptioncounter
  } = response.registerDetails;

  let softtoken = this.get('softtoken');

  softtoken.callSoftTokenService(
          'generateDeviceCode',
          macvalueactivationmessage,
          encryptedactivationmessage,
          encryptioncounter
      )
      .then(response => {
          let {
              deviceCode
          } = response;
          let userId = this.get('userId') || this.get('userPreference.userId');
          let groupId = this.get('groupId') || this.get('userPreference.groupId');

          let payload = {
              deviceCode,
              authorizationCode: this.get('memoizedFields.authorizationCode'),
              tokenSerialNumber: this.get('memoizedFields.tokenSerialNumber'),
              userId,
              groupId,
              notificationId: 'NA'
          };

          this.navigation.toRoute('digital.pinRegistrationFlow', {
              queryParams: {
                  initialState: 'setPin',
                  data: payload
              }
          });
      })
      .catch(err => {
          Logger.error(err);
      });

},

When I try to go to ember route from ember service. I get the following error "Cannot read property toRoute of undefined"

But when I try the same code in the controller. It works fine.

Can anyone help me here please ?




Aucun commentaire:

Enregistrer un commentaire