stecker als array, anstatt der baseurl die adressen der stecker aus dem reverseproxy eingefügt
This commit is contained in:
@@ -4,6 +4,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { environment } from '../environments/environment';
|
||||
import { TasmotaSocket } from './socket.interface'; // NEU: Import des Interfaces
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -13,8 +14,18 @@ export class TasmotaService {
|
||||
? ''
|
||||
: '';
|
||||
|
||||
private SOCKET1_PATH = this.baseUrl + '/tasmota1';
|
||||
private SOCKET2_PATH = this.baseUrl + '/tasmota2';
|
||||
// private SOCKET1_PATH = this.baseUrl + '/tasmota1';
|
||||
// private SOCKET2_PATH = this.baseUrl + '/tasmota2';
|
||||
|
||||
// NEU: Ein öffentliches Array, das alle zu steuernden Steckdosen und ihre Konfiguration enthält
|
||||
public sockets: TasmotaSocket[] = [
|
||||
// { id: '1', name: 'Aktiv Kohle Lüfter', path: this.baseUrl + '/tasmota1', status: false },
|
||||
// { id: '2', name: 'Bambu P1P', path: this.baseUrl + '/tasmota2', status: false }
|
||||
// anstatt der baseurl die adressen der stecker aus dem reverseproxy eingefügt
|
||||
{ id: '1', name: 'Aktiv Kohle Lüfter', path: 'http://stecker1.neugasse.lan', status: false },
|
||||
{ id: '2', name: 'Bambu P1P', path: 'http://stecker1.neugasse.lan', status: false }
|
||||
// Hier können weitere Steckdosen-Objekte hinzugefügt werden
|
||||
];
|
||||
|
||||
private httpOptions = {
|
||||
headers: new HttpHeaders({
|
||||
@@ -40,11 +51,10 @@ export class TasmotaService {
|
||||
);
|
||||
}
|
||||
|
||||
get socket1Path(): string {
|
||||
return this.SOCKET1_PATH;
|
||||
}
|
||||
|
||||
get socket2Path(): string {
|
||||
return this.SOCKET2_PATH;
|
||||
}
|
||||
// ALT: Die Getter `socket1Path` und `socket2Path` werden entfernt,
|
||||
// da die Pfade nun direkt aus dem `sockets`-Array im Service oder in der Komponente bezogen werden.
|
||||
/*
|
||||
get socket1Path(): string { return this.SOCKET1_PATH; }
|
||||
get socket2Path(): string { return this.SOCKET2_PATH; }
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user