fix: create label policy if not exists on font upload (#1898)

This commit is contained in:
Livio Amstutz 2021-06-18 10:12:40 +02:00 committed by GitHub
parent fd04fb58d0
commit ab88d311f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -309,7 +309,7 @@ export class PrivateLabelingPolicyComponent implements OnDestroy {
}
private handleFontUploadPromise(task: Promise<any>): Promise<any> {
return task.then(() => {
const enhTask = task.then(() => {
this.toast.showInfo('POLICY.TOAST.UPLOADSUCCESS', true);
setTimeout(() => {
this.getPreviewData().then(data => {
@ -319,6 +319,12 @@ export class PrivateLabelingPolicyComponent implements OnDestroy {
});
}, 1000);
}).catch(error => this.toast.showError(error));
if (this.serviceType === PolicyComponentServiceType.MGMT && ((this.previewData as LabelPolicy.AsObject).isDefault)) {
return this.savePolicy().then(() => enhTask);
} else {
return enhTask;
}
}
private handleUploadPromise(task: Promise<any>): Promise<any> {