Skip to content

API_BASE_URL is not resolved #1398

@erikmourits

Description

@erikmourits

Describe the bug
API_BASE_URL is not resolved. This is an issue when running the application in IIS within another application in a folder.

To Reproduce
Remove the @optional tag in de web-api-client.ts
Run the application
See the console for the error

Expected behavior
When running under a folder the application should work

Screenshots

Additional context
Possible solution:
In main.ts add provider for API_BASE_URL

export function getApiBaseUrl() {
  var url = document.getElementsByTagName('base')[0].href;
  if (url.endsWith('/')) {
    url = url.substring(0, url.length - 1);
  }
  return url;
}
const providers = [
  { provide: 'BASE_URL', useFactory: getBaseUrl, deps: [] },
  { provide: API_BASE_URL, useFactory: getApiBaseUrl }
];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions