mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-13 16:42:34 +00:00
fix: return full url of assets in admin and mgmt api (#3157)
* fix: return full url of assets in admin and mgmt api * remove asset loading over asset service * remove unused code Co-authored-by: Max Peintner <max@caos.ch>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { AssetService } from 'src/app/services/asset.service';
|
||||
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
@@ -17,9 +16,7 @@ export class ProfilePictureComponent {
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private toast: ToastService,
|
||||
private assetService: AssetService,
|
||||
private sanitizer: DomSanitizer,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
public onDrop(event: any): Promise<any> | void {
|
||||
const filelist: FileList = event.target.files;
|
||||
@@ -33,25 +30,26 @@ export class ProfilePictureComponent {
|
||||
}
|
||||
|
||||
public deletePic(): void {
|
||||
this.authService.removeMyAvatar().then(() => {
|
||||
this.toast.showInfo('USER.PROFILE.AVATAR.DELETESUCCESS', true);
|
||||
this.data.profilePic = null;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
this.authService
|
||||
.removeMyAvatar()
|
||||
.then(() => {
|
||||
this.toast.showInfo('USER.PROFILE.AVATAR.DELETESUCCESS', true);
|
||||
this.data.profilePic = null;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
private handleUploadPromise(task: Promise<any>): Promise<any> {
|
||||
return task.then(() => {
|
||||
this.toast.showInfo('POLICY.TOAST.UPLOADSUCCESS', true);
|
||||
this.assetService.load('users/me/avatar').then(data => {
|
||||
const objectURL = URL.createObjectURL(data);
|
||||
const pic = this.sanitizer.bypassSecurityTrustUrl(objectURL);
|
||||
this.data.profilePic = pic;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}).catch(error => this.toast.showError(error));
|
||||
return task
|
||||
.then(() => {
|
||||
this.toast.showInfo('POLICY.TOAST.UPLOADSUCCESS', true);
|
||||
this.authService.getMyUser().then((resp) => {
|
||||
this.data.profilePic = resp.user?.human?.profile?.avatarUrl ?? '';
|
||||
});
|
||||
})
|
||||
.catch((error) => this.toast.showError(error));
|
||||
}
|
||||
|
||||
public closeDialog(): void {
|
||||
|
||||
Reference in New Issue
Block a user