fix: make shared module independent of config.js (#1870)

This commit is contained in:
Alex Inkin
2022-10-11 11:23:34 +03:00
committed by Aiden McClelland
parent 9998ed177b
commit 8beda5b0ae
6 changed files with 46 additions and 21 deletions

View File

@@ -1,14 +1,6 @@
import { DOCUMENT } from '@angular/common'
import { Inject, Injectable } from '@angular/core'
import { HttpClient } from '@angular/common/http'
import { HttpError } from '../classes/http-error'
import {
HttpAngularOptions,
HttpOptions,
LocalHttpResponse,
Method,
} from '../types/http.types'
import { RPCResponse, RPCOptions } from '../types/rpc.types'
import { WorkspaceConfig } from '../types/workspace-config'
import {
firstValueFrom,
from,
@@ -19,20 +11,25 @@ import {
race,
take,
} from 'rxjs'
import { DOCUMENT } from '@angular/common'
const {
ui: { api },
} = require('../../../../config.json') as WorkspaceConfig
import { HttpError } from '../classes/http-error'
import {
HttpAngularOptions,
HttpOptions,
LocalHttpResponse,
Method,
} from '../types/http.types'
import { RPCResponse, RPCOptions } from '../types/rpc.types'
import { RELATIVE_URL } from '../tokens/relative-url'
@Injectable({
providedIn: 'root',
})
export class HttpService {
relativeUrl = `/${api.url}/${api.version}`
private fullUrl: string
constructor(
@Inject(RELATIVE_URL) private readonly relativeUrl: string,
@Inject(DOCUMENT) private readonly document: Document,
private readonly http: HttpClient,
) {