From 7af36063cb1d98fb0f66ccbb010c00c28061a888 Mon Sep 17 00:00:00 2001 From: Daniel Haselhan Date: Wed, 29 May 2024 11:21:09 -0700 Subject: [PATCH] Change search failure toast message --- .../src/app/services/search/search.service.ts | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/portal-frontend/src/app/services/search/search.service.ts b/portal-frontend/src/app/services/search/search.service.ts index 64befbd2c3..d2719e04f0 100644 --- a/portal-frontend/src/app/services/search/search.service.ts +++ b/portal-frontend/src/app/services/search/search.service.ts @@ -5,11 +5,11 @@ import { environment } from '../../../environments/environment'; import { ToastService } from '../toast/toast.service'; import { AdvancedSearchEntityResponseDto, - SearchResponseDto, BaseSearchResultDto, NoticeOfIntentSearchResultDto, NotificationSearchResultDto, SearchRequestDto, + SearchResponseDto, } from './search.dto'; @Injectable({ @@ -18,14 +18,17 @@ import { export class SearchService { private baseUrl = `${environment.authUrl}/public/search`; - constructor(private http: HttpClient, private toastService: ToastService) {} + constructor( + private http: HttpClient, + private toastService: ToastService, + ) {} async search(searchDto: SearchRequestDto) { try { return await firstValueFrom(this.http.post(`${this.baseUrl}`, searchDto)); } catch (e) { console.error(e); - this.toastService.showErrorToast(`Search failed. Please refresh the page and try again`); + this.toastService.showErrorToast(`Search failed. Please add more criteria to narrow your search and try again.`); return undefined; } } @@ -33,11 +36,11 @@ export class SearchService { async searchApplications(searchDto: SearchRequestDto) { try { return await firstValueFrom( - this.http.post>(`${this.baseUrl}/application`, searchDto) + this.http.post>(`${this.baseUrl}/application`, searchDto), ); } catch (e) { console.error(e); - this.toastService.showErrorToast(`Search failed. Please refresh the page and try again`); + this.toastService.showErrorToast(`Search failed. Please add more criteria to narrow your search and try again.`); return undefined; } } @@ -47,12 +50,12 @@ export class SearchService { return await firstValueFrom( this.http.post>( `${this.baseUrl}/notice-of-intent`, - searchDto - ) + searchDto, + ), ); } catch (e) { console.error(e); - this.toastService.showErrorToast(`Search failed. Please refresh the page and try again`); + this.toastService.showErrorToast(`Search failed. Please add more criteria to narrow your search and try again.`); return undefined; } } @@ -62,12 +65,12 @@ export class SearchService { return await firstValueFrom( this.http.post>( `${this.baseUrl}/notifications`, - searchDto - ) + searchDto, + ), ); } catch (e) { console.error(e); - this.toastService.showErrorToast(`Search failed. Please refresh the page and try again`); + this.toastService.showErrorToast(`Search failed. Please add more criteria to narrow your search and try again.`); return undefined; } }