mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 20:43:41 +00:00
fix: make shared module independent of config.js (#1870)
This commit is contained in:
committed by
Aiden McClelland
parent
9998ed177b
commit
8beda5b0ae
@@ -45,6 +45,8 @@ export * from './types/rpc.types'
|
||||
export * from './types/url'
|
||||
export * from './types/workspace-config'
|
||||
|
||||
export * from './tokens/relative-url'
|
||||
|
||||
export * from './util/copy-to-clipboard'
|
||||
export * from './util/base-64'
|
||||
export * from './util/get-pkg-id'
|
||||
|
||||
@@ -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,
|
||||
) {
|
||||
|
||||
5
frontend/projects/shared/src/tokens/relative-url.ts
Normal file
5
frontend/projects/shared/src/tokens/relative-url.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { InjectionToken } from '@angular/core'
|
||||
|
||||
export const RELATIVE_URL = new InjectionToken<string>(
|
||||
'Relative URL for requests',
|
||||
)
|
||||
Reference in New Issue
Block a user