Skip to content

Commit

Permalink
convert manual form onSubmit to action function
Browse files Browse the repository at this point in the history
  • Loading branch information
eritbh committed Dec 10, 2024
1 parent f005964 commit 90e4a35
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions extension/data/modules/modnotes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,7 @@ function ModNotesPopup ({
}

// Handle note creation
async function handleNewNoteSubmit (event) {
// don't actually perform the HTML form action
event.preventDefault();
const formData = new FormData(event.target);

async function submitNewNote (formData) {
try {
await TBApi.createModNote({
user,
Expand Down Expand Up @@ -439,7 +435,7 @@ function ModNotesPopup ({
}, []);

const popupFooter = (
<form className={css.modnoteCreateForm} onSubmit={handleNewNoteSubmit}>
<form className={css.modnoteCreateForm} action={submitNewNote}>
<ActionSelect
name='label'
defaultValue={defaultNoteLabelValueToLabelType[defaultNoteLabel]}
Expand Down

0 comments on commit 90e4a35

Please sign in to comment.