ITWEMO-56

routing fixed

by Eugen Sunic

JavaScript

__________________
change rest api.ts
__________________
import { Component, OnInit } from '@angular/core';
@Component({
  selector: 'app-change-rest',
  templateUrl: './change-rest.component.html'
})
export class ChangeRestComponent implements OnInit {

  tempGet = '';
  protocolName= 'http://';

  ngOnInit() {
   this.tempGet = this.fullApiAddress('service-host');
  }

  changeRestApi(restApiLink) {
    if (restApiLink.target.value !== '') {
       localStorage.setItem('service-host', restApiLink.target.value);
    }
    this.tempGet = this.fullApiAddress('service-host');

  }
  defaultValue() {
    localStorage.setItem('service-host', localStorage.getItem('initial-host'));
    this.tempGet = this.fullApiAddress('initial-host');
  }
  fullApiAddress(host) {
    return this.protocolName + localStorage.getItem(host) + '/web-taxes-service/api';
  }


}
____________________
change rest api.html
____________________
<div class="container-fluid">
  <div class="row">

    <div class="col-sm-6">
      <p>Show current path (don't write here)</p>
      <input class="input special_first" type="text" name="" [value]="tempGet" readonly="readonly">
    </div>

    <div class="col-sm-6">
      <p>change path if you want (if not current will be used)</p>
      <input (change)="changeRestApi($event)" class="input special_second" type="text" name="" value="">
      <br/>
      <p>If this field is empty the current path will be used</p>
    </div>

  </div>
  <button (click)="defaultValue()" type="button" name="button">Default</button>
</div>
______________________
enrivroment.ts service
______________________

import {Injectable} from '@angular/core';
import {environment} from '../../environments/environment';

@Injectable()
export class EnvironmentService {

  private static readonly API_PATH = '/web-taxes-service/api';
  private static readonly PROTOCOL = 'http://';

  getWebTaxesServiceUrl(): string {

    if ((window as any).consorsmode === 'PREVIEW') {

      let baseUrl =...