Skip to content

Commit

Permalink
fix scoping issue with handleTranslationComplete
Browse files Browse the repository at this point in the history
  • Loading branch information
sorochak committed Jan 10, 2024
1 parent 922555b commit ba87864
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/components/Pages/MetadataForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ class MetadataForm extends FormClassTemplate {
}));
};

handleTranslationComplete = (fieldName) => (message) => {
const translationMethodField = `${fieldName}TranslationMethod`;
this.updateRecord(translationMethodField)(message);
};

saveUpdateContact(contact) {
const { contactID } = contact;
const { match } = this.props;
Expand Down Expand Up @@ -374,6 +379,7 @@ class MetadataForm extends FormClassTemplate {
record,
handleUpdateRecord: this.handleUpdateRecord,
updateRecord: this.updateRecord,
handleTranslationComplete: this.handleTranslationComplete,
};
const percentValidInt = Math.round(percentValid(record) * 100);
return loading ? (
Expand Down
6 changes: 1 addition & 5 deletions src/components/Tabs/IdentificationTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const IdentificationTab = ({
record,
handleUpdateRecord,
updateRecord,
handleTranslationComplete,
projects,
}) => {
const { createDraftDoi, updateDraftDoi, deleteDraftDoi } = useContext(UserContext);
Expand Down Expand Up @@ -78,11 +79,6 @@ const IdentificationTab = ({
)
);

const handleTranslationComplete = (fieldName) => (message) => {
const translationMethodField = `${fieldName}TranslationMethod`;
updateRecord(translationMethodField)(message);
};

async function handleGenerateDOI() {
setLoadingDoi(true);

Expand Down

0 comments on commit ba87864

Please sign in to comment.