Skip to content
Snippets Groups Projects
Commit 46a0ed11 authored by Milan Bohacek's avatar Milan Bohacek
Browse files

move rest api url to a single location

parent 8cb700da
No related branches found
No related tags found
No related merge requests found
Pipeline #605928 passed
import { Injectable, inject } from '@angular/core'; import { Injectable, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Observable, catchError, of } from 'rxjs'; import { Observable, catchError, of } from 'rxjs';
import {environment} from "../../environments/environment";
export interface PackageEntry { export interface PackageEntry {
module_name: string; module_name: string;
...@@ -26,7 +27,7 @@ export interface AgentRemoval { ...@@ -26,7 +27,7 @@ export interface AgentRemoval {
}) })
export class AgentService { export class AgentService {
private http: HttpClient = inject(HttpClient); private http: HttpClient = inject(HttpClient);
private apiUrl = 'http://127.0.0.1:8000/api/v1/agents/'; private apiUrl = environment.restApiUrl + '/agents/';
constructor() {} constructor() {}
......
import { inject, Injectable } from '@angular/core';import { HttpClient } from '@angular/common/http'; import { inject, Injectable } from '@angular/core';import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import {environment} from "../../environments/environment";
export interface IEnvironment { export interface IEnvironment {
id: string; id: string;
...@@ -48,7 +49,7 @@ interface IValidationError { ...@@ -48,7 +49,7 @@ interface IValidationError {
export class EnvironmentService { export class EnvironmentService {
private http: HttpClient = inject(HttpClient); private http: HttpClient = inject(HttpClient);
private apiUrl = 'http://127.0.0.1:8000/api/v1/environment/'; private apiUrl = environment.restApiUrl + '/environment/';
constructor() { } constructor() { }
......
import { inject, Injectable } from '@angular/core';import { HttpClient } from '@angular/common/http'; import { inject, Injectable } from '@angular/core';import { HttpClient } from '@angular/common/http';
import {catchError, map, Observable, of, switchMap} from 'rxjs'; import {catchError, map, Observable, of, switchMap} from 'rxjs';
import {environment} from "../../environments/environment";
export interface IAvailableScenarios { export interface IAvailableScenarios {
available_configurations: string[]; available_configurations: string[];
...@@ -16,7 +17,7 @@ export interface IScenario { ...@@ -16,7 +17,7 @@ export interface IScenario {
export class ScenarioService { export class ScenarioService {
private http: HttpClient = inject(HttpClient); private http: HttpClient = inject(HttpClient);
private apiUrl = 'http://127.0.0.1:8000/api/v1/scenario/'; private apiUrl = environment.restApiUrl + '/scenario/';
constructor() {} constructor() {}
......
// src/environments/environment.ts
// used when we run `ng serve` or `ng build`
export const environment = {
restApiUrl: 'http://localhost:8000/api/v1/'
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment