This commit is contained in:
Eugene Pankov
2021-09-16 23:36:51 +02:00
parent 533749092a
commit 97b34cd702
63 changed files with 179 additions and 105 deletions

View File

@@ -0,0 +1,25 @@
import { Inject, Injectable, Optional } from '@angular/core'
@Injectable({ providedIn: 'root' })
export class CommonService {
backendURL: string
constructor (@Inject('BACKEND_URL') @Optional() ssrBackendURL: string) {
const tag = (document.querySelector('meta[property=x-tabby-web-backend-url]') as HTMLMetaElement)
if (ssrBackendURL) {
this.backendURL = ssrBackendURL
tag.content = ssrBackendURL
} else {
if (tag.content && !tag.content.startsWith('{{')) {
this.backendURL = tag.content
} else {
this.backendURL = ''
}
}
console.log(this.backendURL)
if (this.backendURL.endsWith('/')) {
this.backendURL = this.backendURL.slice(0, -1)
}
}
}