Skip to content

Commit

Permalink
Remove default URL to allow usage of a custom host name
Browse files Browse the repository at this point in the history
  • Loading branch information
eengnr committed Feb 24, 2024
1 parent 83579f4 commit de12e85
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions src/angular/osww-frontend/src/app/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,23 @@ export interface Status {
})
export class ApiService {

DEFUALT_URL = 'http://winderoo.local';

isWinderEnabled$ = new BehaviorSubject(0);
shouldRefresh$ = new BehaviorSubject(false);

constructor(private http: HttpClient) { }

static getWindowHref(_window: typeof window): string {
if (_window.location.href.includes('192')) {

// remove single trailing '/' from ip
const sanitizedHref =
_window.location.href.substring(_window.location.href.length - 1) === '/' ?
_window.location.href.substring(0, _window.location.href.length - 1) :
_window.location.href

return sanitizedHref;
}
// remove single trailing '/'
const sanitizedHref =
_window.location.href.substring(_window.location.href.length - 1) === '/'
? _window.location.href.substring(0, _window.location.href.length - 1)
: _window.location.href;

return 'http://winderoo.local';
return sanitizedHref;
}

private constructURL(URL: string): string {
if (URL != this.DEFUALT_URL) {
return URL + "/api/";
}

return this.DEFUALT_URL + '/api/';
return URL + "/api/";
}

getShouldRefresh() {
Expand Down

0 comments on commit de12e85

Please sign in to comment.