mirror of
https://gitlab.com/openlp/web-remote.git
synced 2024-12-22 03:22:48 +00:00
Get the remote api port from the url
This commit is contained in:
parent
e7325c674b
commit
db7e4ec1a0
@ -2,10 +2,10 @@ import { Injectable, EventEmitter } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { URLSearchParams, Http } from '@angular/http';
|
||||
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
import { PluginDescription, State, Slide, ServiceItem } from './responses';
|
||||
import { environment } from '../environments/environment';
|
||||
|
||||
let deserialize = (json, cls) => {
|
||||
var inst = new cls();
|
||||
@ -20,11 +20,19 @@ let deserialize = (json, cls) => {
|
||||
|
||||
@Injectable()
|
||||
export class OpenLPService {
|
||||
private apiURL: string = 'http://localhost:4316';
|
||||
private apiURL: string;
|
||||
|
||||
public stateChanged$: EventEmitter<State>;
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
let port: string;
|
||||
if (environment.production) {
|
||||
port = window.location.port;
|
||||
} else {
|
||||
port = '4316';
|
||||
}
|
||||
this.apiURL = `http://localhost:${port}`;
|
||||
|
||||
this.stateChanged$ = new EventEmitter<State>();
|
||||
let state:State = null;
|
||||
let ws:WebSocket = new WebSocket('ws://localhost:4317/state')
|
||||
|
Loading…
Reference in New Issue
Block a user