From aa2c6f089c964c4ff13a461d0ebc006377995203 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Fri, 29 Sep 2023 16:40:33 +0300 Subject: [PATCH] Add docs for how to customize tenant not found --- docs/en/UI/Angular/Multi-Tenancy.md | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/en/UI/Angular/Multi-Tenancy.md b/docs/en/UI/Angular/Multi-Tenancy.md index 92f76435ca..f133e5f25e 100644 --- a/docs/en/UI/Angular/Multi-Tenancy.md +++ b/docs/en/UI/Angular/Multi-Tenancy.md @@ -125,6 +125,37 @@ After this replacement, the app will use the following URLs: The app sends the `__tenant` header that contains the current tenant id on each request. +### Handling Domain-based Tenant not found + +When the application is initiated and a domain-based tenant is active, it makes a request for validating tenant. If it cannot be located. The Angular application calls the function. The function displays an error message, but you can customize the functionality by injecting the 'TENANT_NOT_FOUND_BY_NAME' token into the function. + +Example: +```ts +import { TENANT_NOT_FOUND_BY_NAME } from '@abp/ng.core'; + +@NgModule({ + imports: [ + // removed for clarity + ], + providers: [ + // removed for clarity + { + provide: TENANT_NOT_FOUND_BY_NAME, + useFactory: function () { + return () => { + window.location.replace('https://abp.io'); + }; + }, + }, + ], + declarations: [AppComponent], + bootstrap: [AppComponent], +}) +export class AppModule {} + +``` + ## See Also - [Multi Tenancy in ABP](../../Multi-Tenancy.md) +