diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 95a81c7..2a47765 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,6 +1,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { MetamaskNotAllowedNetworkComponent } from './metamask-not-allowed-network'; import { MetamaskNotInstalledComponent } from './metamask-not-installed'; import { MetamaskNotLoggedInComponent } from './metamask-not-logged-in'; import { PageNotFoundComponent } from './page-not-found'; @@ -11,6 +12,10 @@ const routes: Routes = [ redirectTo: '/dashboard/home', pathMatch: 'full' }, + { + path: 'metamask-not-allowed-network', + component: MetamaskNotAllowedNetworkComponent + }, { path: 'metamask-not-installed', component: MetamaskNotInstalledComponent diff --git a/src/app/app.module.ts b/src/app/app.module.ts index f9f266f..866fb5a 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -7,6 +7,7 @@ import { MessageService } from 'primeng/api'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { DashboardModule } from './dashboard'; +import { MetamaskNotAllowedNetworkComponent } from './metamask-not-allowed-network'; import { MetamaskNotInstalledComponent } from './metamask-not-installed'; import { MetamaskNotLoggedInComponent } from './metamask-not-logged-in'; import { PageNotFoundComponent } from './page-not-found'; @@ -14,6 +15,7 @@ import { PageNotFoundComponent } from './page-not-found'; @NgModule({ declarations: [ AppComponent, + MetamaskNotAllowedNetworkComponent, MetamaskNotInstalledComponent, MetamaskNotLoggedInComponent, PageNotFoundComponent diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 52bc9e7..54e7453 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -46,6 +46,9 @@ export class DashboardComponent implements OnInit { if(errorCode == this.web3Service.CONNECTION_NOT_LOGGED_IN) { this.router.navigate(['metamask-not-logged-in']); } + if(errorCode == this.web3Service.CONNECTION_NOT_ALLOWED_NETWORK) { + this.router.navigate(['metamask-not-allowed-network']); + } } }, (err) => { diff --git a/src/app/metamask-not-allowed-network/index.ts b/src/app/metamask-not-allowed-network/index.ts new file mode 100644 index 0000000..0ca5f18 --- /dev/null +++ b/src/app/metamask-not-allowed-network/index.ts @@ -0,0 +1 @@ +export { MetamaskNotAllowedNetworkComponent } from './metamask-not-allowed-network.component'; diff --git a/src/app/metamask-not-allowed-network/metamask-not-allowed-network.component.css b/src/app/metamask-not-allowed-network/metamask-not-allowed-network.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/metamask-not-allowed-network/metamask-not-allowed-network.component.html b/src/app/metamask-not-allowed-network/metamask-not-allowed-network.component.html new file mode 100644 index 0000000..f5ce7b8 --- /dev/null +++ b/src/app/metamask-not-allowed-network/metamask-not-allowed-network.component.html @@ -0,0 +1,5 @@ +