Loading src/app/common/services/sso.service.ts +8 −8 Original line number Original line Diff line number Diff line Loading @@ -6,15 +6,12 @@ import { ConfigsService } from './configs.service'; @Injectable() @Injectable() export class SsoService { export class SsoService { protected readonly siteUrl: string; constructor( constructor( protected site: SiteService, protected site: SiteService, protected client: Client, protected client: Client, protected session: Session, protected session: Session, configs: ConfigsService private configs: ConfigsService ) { ) { this.siteUrl = configs.get('site_url'); this.listen(); this.listen(); } } Loading @@ -33,7 +30,7 @@ export class SsoService { async connect() { async connect() { try { try { const connect: any = await this.client.postRaw( const connect: any = await this.client.postRaw( `${this.siteUrl}api/v2/sso/connect` `${this.configs.get('site_url')}api/v2/sso/connect` ); ); if (connect && connect.token && connect.status === 'success') { if (connect && connect.token && connect.status === 'success') { Loading @@ -58,9 +55,12 @@ export class SsoService { const connect: any = await this.client.post('api/v2/sso/connect'); const connect: any = await this.client.post('api/v2/sso/connect'); if (connect && connect.token && connect.status === 'success') { if (connect && connect.token && connect.status === 'success') { await this.client.postRaw(`${this.siteUrl}api/v2/sso/authorize`, { await this.client.postRaw( `${this.configs.get('site_url')}api/v2/sso/authorize`, { token: connect.token, token: connect.token, }); } ); } } } catch (e) { } catch (e) { console.error(e); console.error(e); Loading Loading
src/app/common/services/sso.service.ts +8 −8 Original line number Original line Diff line number Diff line Loading @@ -6,15 +6,12 @@ import { ConfigsService } from './configs.service'; @Injectable() @Injectable() export class SsoService { export class SsoService { protected readonly siteUrl: string; constructor( constructor( protected site: SiteService, protected site: SiteService, protected client: Client, protected client: Client, protected session: Session, protected session: Session, configs: ConfigsService private configs: ConfigsService ) { ) { this.siteUrl = configs.get('site_url'); this.listen(); this.listen(); } } Loading @@ -33,7 +30,7 @@ export class SsoService { async connect() { async connect() { try { try { const connect: any = await this.client.postRaw( const connect: any = await this.client.postRaw( `${this.siteUrl}api/v2/sso/connect` `${this.configs.get('site_url')}api/v2/sso/connect` ); ); if (connect && connect.token && connect.status === 'success') { if (connect && connect.token && connect.status === 'success') { Loading @@ -58,9 +55,12 @@ export class SsoService { const connect: any = await this.client.post('api/v2/sso/connect'); const connect: any = await this.client.post('api/v2/sso/connect'); if (connect && connect.token && connect.status === 'success') { if (connect && connect.token && connect.status === 'success') { await this.client.postRaw(`${this.siteUrl}api/v2/sso/authorize`, { await this.client.postRaw( `${this.configs.get('site_url')}api/v2/sso/authorize`, { token: connect.token, token: connect.token, }); } ); } } } catch (e) { } catch (e) { console.error(e); console.error(e); Loading