mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
feat: migrate to Angular 14 and RxJS 7 (#1681)
* feat: migrate to Angular 14 and RxJS 7 * chore: update ng-qrcode * chore: update patch-db * chore: remove unnecessary generics
This commit is contained in:
@@ -15,7 +15,6 @@ const { useMocks } = require('../../../../config.json') as WorkspaceConfig
|
||||
|
||||
@NgModule({
|
||||
declarations: [AppComponent],
|
||||
entryComponents: [],
|
||||
imports: [
|
||||
HttpClientModule,
|
||||
BrowserModule,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HttpClient } from '@angular/common/http'
|
||||
import { HttpError, RpcError } from '@start9labs/shared'
|
||||
import { firstValueFrom } from 'rxjs'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -16,13 +17,9 @@ export class HttpService {
|
||||
|
||||
async httpRequest<T>(body: RPCOptions): Promise<T> {
|
||||
const url = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/rpc/v1`
|
||||
return this.http
|
||||
.post(url, body)
|
||||
.toPromise()
|
||||
.then(a => a as T)
|
||||
.catch(e => {
|
||||
throw new HttpError(e)
|
||||
})
|
||||
return firstValueFrom(this.http.post<T>(url, body)).catch(e => {
|
||||
throw new HttpError(e)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user