Merge pull request #13314 from abpframework/issue/10947

Add GetIssuer functon on EnvironmentService
pull/13269/head
Muhammed Altuğ 3 years ago committed by GitHub
commit 3db6aaa7f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -7,6 +7,13 @@ import { InternalStore } from '../utils/internal-store-utils';
const mapToApiUrl = (key: string) => (apis: Apis) =>
(apis[key] || apis.default).url || apis.default.url;
const mapToIssuer = (issuer: string) => {
if (!issuer) {
return issuer;
}
return issuer.endsWith('/') ? issuer : issuer + '/';
};
@Injectable({ providedIn: 'root' })
export class EnvironmentService {
private readonly store = new InternalStore({} as Environment);
@ -34,4 +41,13 @@ export class EnvironmentService {
setState(environment: Environment) {
this.store.set(environment);
}
getIssuer() {
const issuer = this.store.state.oAuthConfig.issuer;
return mapToIssuer(issuer);
}
getIssuer$() {
return this.store.sliceState(state => state.oAuthConfig.issuer).pipe(map(mapToIssuer));
}
}

Loading…
Cancel
Save