Skip to content

Commit

Permalink
feat (client): info notice
Browse files Browse the repository at this point in the history
  • Loading branch information
KostaD02 committed Jul 22, 2024
1 parent 4791ef6 commit f59bcb6
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions client/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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 <a href="https://github.com/KostaD02/ShopLoyalty" target="_blank">Github</a>`,
});
return EMPTY;
}

export const appConfig: ApplicationConfig = {
providers: [
provideRouter(routes),
provideClientHydration(),
provideAnimationsAsync(),
provideHttpClient(withFetch(), withInterceptorsFromDi()),
provideHttpClient(
withFetch(),
withInterceptors([loggingInterceptor]),
withInterceptorsFromDi(),
),
importProvidersFrom(
JwtModule.forRoot({
config: {
Expand Down

0 comments on commit f59bcb6

Please sign in to comment.