remove expired room

This commit is contained in:
Peter Maquiran
2024-10-07 13:27:49 +01:00
parent d8eb3ddbd6
commit 0dd4fd665b
101 changed files with 698 additions and 4682 deletions
+18 -3
View File
@@ -3,7 +3,9 @@ import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { ok, err, Result } from 'neverthrow';
import { HttpResult } from './type';
import { BehaviorSubject } from 'rxjs';
import { BehaviorSubject, Observable } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { IHttpOptions } from './adapter';
@Injectable({
providedIn: 'root'
@@ -32,9 +34,22 @@ export class HttpService {
}
}
async get<T>(url: string, options = {}): Promise<Result<HttpResult<T>, HttpErrorResponse>> {
async get<T>(url: string, options?: IHttpOptions): Promise<Result<HttpResult<T>, HttpErrorResponse>> {
try {
const response = await this.http.get<T>(url, { ...options, observe: 'response' }).toPromise();
let httpParams = new HttpParams();
if (options?.params) {
Object.keys(options.params).forEach(key => {
httpParams = httpParams.append(key, String(options.params[key]));
});
}
const httpOptions = {
params: httpParams,
headers: options?.headers || new HttpHeaders(),
responseType: options?.responseType || 'json' as any,
};
const response = await this.http.get<T>(url, { ...httpOptions, observe: 'response', responseType: httpOptions.responseType }).toPromise();
const data = {
method: 'GET',