Timeout nur für /ai Calls, URL compare change
This commit is contained in:
@@ -8,6 +8,8 @@ export class TimeoutInterceptor implements HttpInterceptor {
|
|||||||
constructor(@Optional() @Inject('TIMEOUT_DURATION') private timeoutDuration: number = 5000) {}
|
constructor(@Optional() @Inject('TIMEOUT_DURATION') private timeoutDuration: number = 5000) {}
|
||||||
|
|
||||||
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||||
|
// Überprüfen, ob die URL mit '/ai' endet
|
||||||
|
if (req.url.endsWith('/ai')) {
|
||||||
return next.handle(req).pipe(
|
return next.handle(req).pipe(
|
||||||
timeout(this.timeoutDuration),
|
timeout(this.timeoutDuration),
|
||||||
catchError((error: any) => {
|
catchError((error: any) => {
|
||||||
@@ -25,4 +27,8 @@ export class TimeoutInterceptor implements HttpInterceptor {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Für alle anderen URLs ohne Timeout fortfahren
|
||||||
|
return next.handle(req);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ export class EditBusinessListingComponent {
|
|||||||
) {
|
) {
|
||||||
this.router.events.subscribe(event => {
|
this.router.events.subscribe(event => {
|
||||||
if (event instanceof NavigationEnd) {
|
if (event instanceof NavigationEnd) {
|
||||||
this.mode = event.url === '/createBusinessListing' ? 'create' : 'edit';
|
this.mode = event.url.startsWith('/createBusinessListing') ? 'create' : 'edit';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.route.data.subscribe(async () => {
|
this.route.data.subscribe(async () => {
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ export class EditCommercialPropertyListingComponent {
|
|||||||
// Abonniere Router-Events, um den aktiven Link zu ermitteln
|
// Abonniere Router-Events, um den aktiven Link zu ermitteln
|
||||||
this.router.events.subscribe(event => {
|
this.router.events.subscribe(event => {
|
||||||
if (event instanceof NavigationEnd) {
|
if (event instanceof NavigationEnd) {
|
||||||
this.mode = event.url === '/createCommercialPropertyListing' ? 'create' : 'edit';
|
this.mode = event.url.startsWith('/createCommercialPropertyListing') ? 'create' : 'edit';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.route.data.subscribe(async () => {
|
this.route.data.subscribe(async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user