@idsoftsource/initial-process 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4984,6 +4984,7 @@ class RoleSelectComponent {
4984
4984
  tokenService;
4985
4985
  fb;
4986
4986
  previewUrl = null;
4987
+ isMappingCreated = false;
4987
4988
  initialSelectedJobValue;
4988
4989
  previousEmployeeType;
4989
4990
  selectedTab;
@@ -5386,11 +5387,19 @@ class RoleSelectComponent {
5386
5387
  employeeType: currentEmployeeType,
5387
5388
  status: ProviderUserMappingStatus.WaitingForApproval
5388
5389
  };
5389
- const hasEmployeeTypeChanged = this.previousEmployeeType !== currentEmployeeType;
5390
5390
  this.showLoader = true;
5391
- const apiCall$ = hasEmployeeTypeChanged
5392
- ? this.provideruser.updateProviderUserMapping(model) // 🔁 PUT
5393
- : this.provideruser.createProviderUserMapping(model); // ➕ POST
5391
+ let apiCall$;
5392
+ if (!this.isMappingCreated) {
5393
+ apiCall$ = this.provideruser.createProviderUserMapping(model);
5394
+ }
5395
+ else if (this.previousEmployeeType !== currentEmployeeType) {
5396
+ apiCall$ = this.provideruser.updateProviderUserMapping(model);
5397
+ }
5398
+ else {
5399
+ this.showLoader = false;
5400
+ this.store.nextStep();
5401
+ return;
5402
+ }
5394
5403
  apiCall$.subscribe({
5395
5404
  next: (res) => {
5396
5405
  this.showLoader = false;
@@ -5398,7 +5407,7 @@ class RoleSelectComponent {
5398
5407
  this.userError = res.failures?.[0]?.message;
5399
5408
  return;
5400
5409
  }
5401
- // update stored value after success
5410
+ this.isMappingCreated = true;
5402
5411
  this.previousEmployeeType = currentEmployeeType;
5403
5412
  this.store.nextStep();
5404
5413
  },