fix
This commit is contained in:
parent
374aab6603
commit
2bc7d88227
3 changed files with 10 additions and 21 deletions
|
@ -28,7 +28,7 @@ const useStyles = makeStyles(
|
|||
marginLeft: theme.spacing(2)
|
||||
}
|
||||
}),
|
||||
{ name: "closeableInputWrapper" }
|
||||
{ name: "DateVisibilitySelector" }
|
||||
);
|
||||
|
||||
interface Props {
|
||||
|
|
|
@ -189,12 +189,12 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
|
|||
|
||||
const getAvailabilityData = ({
|
||||
availableForPurchase,
|
||||
isAvailableForPurchase,
|
||||
isPublished,
|
||||
publicationDate
|
||||
}: ProductUpdatePageFormData) => ({
|
||||
isAvailableForPurchase: !!availableForPurchase,
|
||||
isPublished: isPublished || !!publicationDate,
|
||||
startDate: availableForPurchase || null
|
||||
isAvailableForPurchase: isAvailableForPurchase || !!availableForPurchase,
|
||||
isPublished: isPublished || !!publicationDate
|
||||
});
|
||||
|
||||
const getStocksData = () => {
|
||||
|
|
|
@ -77,23 +77,12 @@ interface ProductAvailabilityArgs {
|
|||
productId: string;
|
||||
}
|
||||
|
||||
export function getProductAvailabilityVariables({
|
||||
export const getProductAvailabilityVariables = ({
|
||||
isAvailableForPurchase,
|
||||
availableForPurchase,
|
||||
productId
|
||||
}: ProductAvailabilityArgs) {
|
||||
const isAvailable =
|
||||
availableForPurchase && !isAvailableForPurchase
|
||||
? true
|
||||
: isAvailableForPurchase;
|
||||
|
||||
return {
|
||||
isAvailable,
|
||||
productId,
|
||||
startDate: isAvailableForPurchase
|
||||
? null
|
||||
: availableForPurchase !== ""
|
||||
? availableForPurchase
|
||||
: null
|
||||
};
|
||||
}
|
||||
}: ProductAvailabilityArgs) => ({
|
||||
isAvailable: isAvailableForPurchase,
|
||||
productId,
|
||||
startDate: availableForPurchase
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue