mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-05 07:22:05 +00:00
feat(console): integrate frontend (#95)
* feat: console frontend * chore(dependabot): cycle and npm * chore: rename citadel to zitadel, remove generated files * chore: delete go files * chore(frontend): ci steps * chore: remove docker and envoy files * chore: remove docker file * chore: working dir * chore: run proto build * add console start * chore: restructure folders * chore: remove gui build * statikFs * generate proto for console * add statik import * import * chore: try statik * chore: path * chore: path * chore: script in root * chore: order build steps * chore: go get * chore: folder traversal * chore: non empty test file * chore: gitignore * chore: gitignore * chore: statik path * chore: switch to failing FE build * fix: build * fix: project-grant-test * fix: rm test * add statik.go * go mod tidy * chore: place test, seperate test from build * chore: lint all the world * chore: ci the world instead * chore: tune docker * chore: undo container test * chore: fix run * chore: docker build * chore: test docker build * chore: go build flags * finaly * fix caos_local * go mod Co-authored-by: Livio Amstutz <livio.a@gmail.com> Co-authored-by: Max Peintner <max@caos.ch>
This commit is contained in:
48
console/src/app/services/grpc.service.ts
Normal file
48
console/src/app/services/grpc.service.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { AdminServicePromiseClient } from '../proto/generated/admin_grpc_web_pb';
|
||||
import { AuthServicePromiseClient } from '../proto/generated/auth_grpc_web_pb';
|
||||
import { ManagementServicePromiseClient } from '../proto/generated/management_grpc_web_pb';
|
||||
import { GrpcRequestFn } from './grpc-handler';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class GrpcService {
|
||||
public issuer: string = '';
|
||||
public clientid: string = '';
|
||||
|
||||
public auth!: AuthServicePromiseClient;
|
||||
public mgmt!: ManagementServicePromiseClient;
|
||||
public admin!: AdminServicePromiseClient;
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
) { }
|
||||
|
||||
public async loadAppEnvironment(): Promise<any> {
|
||||
return this.http.get('/assets/environment.json')
|
||||
.toPromise().then((data: any) => {
|
||||
if (data && data.authServiceUrl && data.mgmtServiceUrl && data.issuer) {
|
||||
this.auth = new AuthServicePromiseClient(data.authServiceUrl);
|
||||
this.mgmt = new ManagementServicePromiseClient(data.mgmtServiceUrl);
|
||||
this.admin = new AdminServicePromiseClient(data.adminServiceUrl);
|
||||
|
||||
this.issuer = data.issuer;
|
||||
if (data.clientid) {
|
||||
this.clientid = data.clientid;
|
||||
}
|
||||
}
|
||||
return Promise.resolve(data);
|
||||
}).catch(() => {
|
||||
console.log('Failed to load environment from assets');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export type RequestFactory<TClient, TReq, TResp> = (
|
||||
client: TClient,
|
||||
) => GrpcRequestFn<TReq, TResp>;
|
||||
|
||||
export type ResponseMapper<TResp, TMappedResp> = (resp: TResp) => TMappedResp;
|
||||
Reference in New Issue
Block a user