From f59bcb68ae8a3b5c09dc47214685f9442032c1fb Mon Sep 17 00:00:00 2001 From: Kosta <68782786+KostaD02@users.noreply.github.com> Date: Mon, 22 Jul 2024 21:30:58 +0400 Subject: [PATCH] feat (client): info notice --- client/src/app/app.config.ts | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/client/src/app/app.config.ts b/client/src/app/app.config.ts index 189903a..85dbb7b 100644 --- a/client/src/app/app.config.ts +++ b/client/src/app/app.config.ts @@ -1,10 +1,12 @@ -import { ApplicationConfig, importProvidersFrom } from '@angular/core'; +import { ApplicationConfig, importProvidersFrom, inject } from '@angular/core'; import { TitleStrategy, provideRouter } from '@angular/router'; -import { provideClientHydration } from '@angular/platform-browser'; +import { provideClientHydration, Title } from '@angular/platform-browser'; import { provideAnimationsAsync } from '@angular/platform-browser/animations/async'; import { + HTTP_INTERCEPTORS, provideHttpClient, withFetch, + withInterceptors, withInterceptorsFromDi, } from '@angular/common/http'; @@ -13,13 +15,30 @@ import { LocalStorageKeys } from '@app-shared/enums'; import { BACKEND_ENDPOINT_DOMAIN } from './shared'; import { routes } from './app.routes'; import { AppTitleStrategy } from '@app-shared/services'; +import { EMPTY } from 'rxjs'; +import Swal from 'sweetalert2'; + +export function loggingInterceptor() { + Swal.fire({ + title: 'Unfortunatelly, Server is down', + icon: 'info', + text: 'Please try again later', + confirmButtonColor: '#3f51b5', + footer: `Or check code locally Github`, + }); + return EMPTY; +} export const appConfig: ApplicationConfig = { providers: [ provideRouter(routes), provideClientHydration(), provideAnimationsAsync(), - provideHttpClient(withFetch(), withInterceptorsFromDi()), + provideHttpClient( + withFetch(), + withInterceptors([loggingInterceptor]), + withInterceptorsFromDi(), + ), importProvidersFrom( JwtModule.forRoot({ config: {