Browse Source

Currency to Uppercase & add message to notification

pull/3819/head
Madhab Sahoo 11 months ago
parent
commit
6f9ca58b56
  1. 14
      apps/client/src/app/components/admin-market-data/create-asset-profile-dialog/create-asset-profile-dialog.component.ts
  2. 8
      apps/client/src/app/components/admin-overview/admin-overview.component.ts

14
apps/client/src/app/components/admin-market-data/create-asset-profile-dialog/create-asset-profile-dialog.component.ts

@ -84,7 +84,9 @@ export class CreateAssetProfileDialog implements OnInit, OnDestroy {
symbol: this.createAssetProfileForm.get('addSymbol').value symbol: this.createAssetProfileForm.get('addSymbol').value
}); });
} else { } else {
const currency = this.createAssetProfileForm.get('addCurrency').value; const currency = this.createAssetProfileForm
.get('addCurrency')
.value.toUpperCase();
if (currency.length === 3) { if (currency.length === 3) {
const currencies = uniq([...this.customCurrencies, currency]); const currencies = uniq([...this.customCurrencies, currency]);
this.putAdminSetting({ key: PROPERTY_CURRENCIES, value: currencies }); this.putAdminSetting({ key: PROPERTY_CURRENCIES, value: currencies });
@ -94,7 +96,8 @@ export class CreateAssetProfileDialog implements OnInit, OnDestroy {
}); });
} else { } else {
this.notificationService.alert({ this.notificationService.alert({
title: $localize`${currency} is an invalid currency!` title: $localize`${currency} is an invalid currency!`,
message: $localize`Currency should be 3 characters in length`
}); });
} }
} }
@ -146,6 +149,11 @@ export class CreateAssetProfileDialog implements OnInit, OnDestroy {
.putAdminSetting(key, { .putAdminSetting(key, {
value: value || value === false ? JSON.stringify(value) : undefined value: value || value === false ? JSON.stringify(value) : undefined
}) })
.pipe(takeUntil(this.unsubscribeSubject)); .pipe(takeUntil(this.unsubscribeSubject))
.subscribe(() => {
setTimeout(() => {
window.location.reload();
}, 300);
});
} }
} }

8
apps/client/src/app/components/admin-overview/admin-overview.component.ts

@ -126,11 +126,15 @@ export class AdminOverviewComponent implements OnDestroy, OnInit {
if (currency) { if (currency) {
if (currency.length === 3) { if (currency.length === 3) {
const currencies = uniq([...this.customCurrencies, currency]); const currencies = uniq([
...this.customCurrencies,
currency.toUpperCase()
]);
this.putAdminSetting({ key: PROPERTY_CURRENCIES, value: currencies }); this.putAdminSetting({ key: PROPERTY_CURRENCIES, value: currencies });
} else { } else {
this.notificationService.alert({ this.notificationService.alert({
title: $localize`${currency} is an invalid currency!` title: $localize`${currency} is an invalid currency!`,
message: $localize`Currency should be 3 characters in length`
}); });
} }
} }

Loading…
Cancel
Save