Files
tabby-web/src/services/common.service.ts

19 lines
515 B
TypeScript
Raw Normal View History

2021-07-25 14:00:22 +02:00
import { Injectable } from '@angular/core'
@Injectable({ providedIn: 'root' })
export class CommonService {
private backendURL?: string
async getBackendURL (): Promise<string> {
if (!this.backendURL) {
const config = await (await fetch('/config.json')).json()
this.backendURL = config.backendURL
if (this.backendURL.endsWith('/')) {
this.backendURL = this.backendURL.slice(0, -1)
}
}
return this.backendURL
}
}