fix: project fetch on init (#1650)

This commit is contained in:
Max Peintner 2021-04-22 16:57:34 +02:00 committed by GitHub
parent b3fc0d6f45
commit 221049bc40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,9 +62,20 @@ export class UserGrantCreateComponent implements OnDestroy {
if (this.projectId && !this.grantId) {
this.context = UserGrantContext.OWNED_PROJECT;
this.mgmtService.getProjectByID(this.projectId).then(resp => {
if (resp.project) {
this.project = resp.project;
}
}).catch((error: any) => {
this.toast.showError(error);
});
} else if (this.projectId && this.grantId) {
this.context = UserGrantContext.GRANTED_PROJECT;
this.mgmtService.getGrantedProjectByID(this.projectId, this.grantId).then(resp => {
if (resp.grantedProject) {
this.project = resp.grantedProject;
}
if (resp.grantedProject?.grantedRoleKeysList) {
this.grantedRoleKeysList = resp.grantedProject?.grantedRoleKeysList;
}