Fixed Offers not saving fixed amount discount (#19077)

no issue

- Offers with a fixed amount wasn't saving due to the type not updating
from percent to fixed.
This commit is contained in:
Ronald Langeveld 2023-11-21 19:31:28 +07:00 committed by GitHub
parent 98941cef3a
commit b5c3def92b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,7 +98,7 @@ const Sidebar: React.FC<SidebarProps> = ({tierOptions,
<h2 className='mb-4 text-lg'>Offer details</h2>
<div className='flex flex-col gap-6'>
<div className='flex flex-col gap-4 rounded-md border border-grey-200 p-4'>
<ButtonSelect checked={overrides.type === 'percent' ? true : false} type={typeOptions[0]} onClick={() => {
<ButtonSelect checked={overrides.type !== 'trial' ? true : false} type={typeOptions[0]} onClick={() => {
handleTypeChange('percent');
}} />
<ButtonSelect checked={overrides.type === 'trial' ? true : false} type={typeOptions[1]} onClick={() => {
@ -320,7 +320,8 @@ const AddOfferModal = () => {
const handleAmountTypeChange = (amountType: string) => {
updateForm(state => ({
...state,
amountType: amountType
amountType: amountType,
type: amountType === 'percent' ? 'percent' : 'fixed' || state.type
}));
};