mirror of
https://github.com/Eugeny/tabby-web.git
synced 2026-08-18 23:36:05 +01:00
wip
This commit is contained in:
18
src/services/common.service.ts
Normal file
18
src/services/common.service.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user