remove abort for now

This commit is contained in:
Maris 2024-07-07 13:25:13 +02:00
parent 59262079ed
commit 8922b7856a
1 changed files with 5 additions and 5 deletions

View File

@ -23,26 +23,26 @@ export class OldpApi {
} }
private async getRawSearchResults(searchTerm: string): Promise<string | null> { private async getRawSearchResults(searchTerm: string): Promise<string | null> {
if (this.abortController) { /*if (this.abortController) {
// Abort the current request // Abort the current request
this.abortController.abort(); this.abortController.abort();
} }
// Create a new AbortController for the new request // TODO: fix this, after one abort all requests afterwords don't get used
this.abortController = new AbortController(); this.abortController = new AbortController();*/
try { try {
const url = `${this.baseUrl}/search/?selected_facets=facet_model_name_exact%3ALaw&q=${encodeURIComponent(searchTerm)}`; const url = `${this.baseUrl}/search/?selected_facets=facet_model_name_exact%3ALaw&q=${encodeURIComponent(searchTerm)}`;
const response = await this.axiosClient.get<string>(`${this.corsProxyUrl}/${url}`, { const response = await this.axiosClient.get<string>(`${this.corsProxyUrl}/${url}`, {
signal: this.abortController.signal, //signal: this.abortController.signal,
}); });
const html = response.data; const html = response.data;
return html; return html;
} catch (error: any) { } catch (error: any) {
// handle aborted "error" // handle aborted "error"
if (this.abortController.signal.aborted || error?.code === 'ERR_CANCELED') return null; //if (this.abortController.signal.aborted || error?.code === 'ERR_CANCELED') return null;
console.error('Error fetching search results:', error); console.error('Error fetching search results:', error);