Skip to content

Commit e2dc70a

Browse files
author
Jon Waldstein
committed
refactor: remove unused campaign from modal
1 parent 306beac commit e2dc70a

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/Campaigns/resources/admin/components/CampaignFormModal/index.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,17 @@ const GoalTypeOption = ({type, label, description, selected, register}: GoalType
7979
* @unreleased remove unused date inputs
8080
* @since 4.0.0
8181
*/
82-
export default function CampaignFormModal({isOpen, handleClose, apiSettings, campaign}: CampaignModalProps) {
82+
export default function CampaignFormModal({isOpen, handleClose, apiSettings}: CampaignModalProps) {
8383
const API = new CampaignsApi(apiSettings);
8484
const [step, setStep] = useState<number>(1);
8585

8686
const methods = useForm<CampaignFormInputs>({
8787
defaultValues: {
88-
title: campaign?.title ?? '',
89-
shortDescription: campaign?.shortDescription ?? '',
90-
image: campaign?.image ?? '',
91-
goalType: campaign?.goalType ?? 'amount',
92-
goal: campaign?.goal ?? null,
88+
title: '',
89+
shortDescription: '',
90+
image: '',
91+
goalType: 'amount',
92+
goal: null,
9393
},
9494
});
9595

@@ -136,8 +136,7 @@ export default function CampaignFormModal({isOpen, handleClose, apiSettings, cam
136136
}
137137

138138
try {
139-
const endpoint = campaign?.id ? `/campaign/${campaign.id}` : '';
140-
const response = await API.fetchWithArgs(endpoint, inputs, 'POST');
139+
const response = await API.fetchWithArgs('', inputs, 'POST');
141140

142141
handleClose(response);
143142
} catch (error) {

src/Campaigns/resources/admin/components/CampaignFormModal/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export interface CampaignModalProps {
77
apiRoot: string;
88
apiNonce: string;
99
};
10-
campaign?: Campaign;
1110
}
1211

1312
export type CampaignFormInputs = {

0 commit comments

Comments
 (0)