diff --git a/src/framework/auth/components/logout/logout.component.ts b/src/framework/auth/components/logout/logout.component.ts index e88f18a17b..759e36f057 100644 --- a/src/framework/auth/components/logout/logout.component.ts +++ b/src/framework/auth/components/logout/logout.component.ts @@ -3,9 +3,11 @@ * Copyright Akveo. All Rights Reserved. * Licensed under the MIT License. See License.txt in the project root for license information. */ -import { Component, OnInit } from '@angular/core'; +import { Component, Inject, OnInit } from '@angular/core'; import { Router } from '@angular/router'; +import { NB_AUTH_OPTIONS_TOKEN } from '../../auth.options'; +import { getDeepFromObject } from '../../helpers'; import { NbAuthService, NbAuthResult } from '../../services/auth.service'; @Component({ @@ -16,14 +18,18 @@ import { NbAuthService, NbAuthResult } from '../../services/auth.service'; }) export class NbLogoutComponent implements OnInit { - redirectDelay: number = 1500; + redirectDelay: number = 0; + provider: string = ''; constructor(protected service: NbAuthService, + @Inject(NB_AUTH_OPTIONS_TOKEN) protected config = {}, protected router: Router) { + this.redirectDelay = this.getConfigValue('forms.logout.redirectDelay'); + this.provider = this.getConfigValue('forms.logout.provider'); } ngOnInit(): void { - this.logout('email'); + this.logout(this.provider); } logout(provider: string): void { @@ -37,4 +43,8 @@ export class NbLogoutComponent implements OnInit { } }); } + + getConfigValue(key: string): any { + return getDeepFromObject(this.config, key, null); + } }