This commit is contained in:
Eugene Pankov
2021-07-25 16:36:45 +02:00
parent 6a78032849
commit c8ee6832f3
57 changed files with 53 additions and 1003 deletions

View File

@@ -0,0 +1,23 @@
import { Injectable } from '@angular/core'
@Injectable({ providedIn: 'root' })
export class CommonService {
private configPromise: Promise<any>
backendURL$: Promise<string>
constructor () {
this.configPromise = this.getConfig()
this.backendURL$ = this.configPromise.then(cfg => {
let backendURL = cfg.backendURL
if (backendURL.endsWith('/')) {
backendURL = backendURL.slice(0, -1)
}
return backendURL
})
}
private async getConfig () {
return (await fetch('/config.json')).json()
}
}