mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-22 14:12:27 +01:00
CORPORATION: Remove non-empty-string condition in sell modals (#1847)
This commit is contained in:
parent
8aea99e5cd
commit
cffd6d75a6
@ -208,6 +208,14 @@ export function acceptInvestmentOffer(corporation: Corporation): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function convertPriceString(price: string): string {
|
export function convertPriceString(price: string): string {
|
||||||
|
/**
|
||||||
|
* This is a common error. We should check it to get a "user-friendly" error message. If we pass an empty string to
|
||||||
|
* eval(), it will return undefined, and the "is-it-a-valid-number" following check will throw an unhelpful error
|
||||||
|
* message.
|
||||||
|
*/
|
||||||
|
if (price === "") {
|
||||||
|
throw new Error("Price cannot be an empty string.");
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Replace invalid characters. Only accepts:
|
* Replace invalid characters. Only accepts:
|
||||||
* - Digit characters
|
* - Digit characters
|
||||||
@ -239,6 +247,14 @@ export function convertPriceString(price: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function convertAmountString(amount: string): string {
|
export function convertAmountString(amount: string): string {
|
||||||
|
/**
|
||||||
|
* This is a common error. We should check it to get a "user-friendly" error message. If we pass an empty string to
|
||||||
|
* eval(), it will return undefined, and the "is-it-a-valid-number" following check will throw an unhelpful error
|
||||||
|
* message.
|
||||||
|
*/
|
||||||
|
if (amount === "") {
|
||||||
|
throw new Error("Amount cannot be an empty string.");
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Replace invalid characters. Only accepts:
|
* Replace invalid characters. Only accepts:
|
||||||
* - Digit characters
|
* - Digit characters
|
||||||
|
@ -31,16 +31,10 @@ export function SellMaterialModal(props: IProps): React.ReactElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onAmtChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
function onAmtChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
||||||
if (event.target.value === "") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setAmt(event.target.value);
|
setAmt(event.target.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPriceChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
function onPriceChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
||||||
if (event.target.value === "") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setPrice(event.target.value);
|
setPrice(event.target.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,16 +39,10 @@ export function SellProductModal(props: IProps): React.ReactElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onAmtChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
function onAmtChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
||||||
if (event.target.value === "") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setAmt(event.target.value);
|
setAmt(event.target.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPriceChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
function onPriceChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
||||||
if (event.target.value === "") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setPrice(event.target.value);
|
setPrice(event.target.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user