Skip to content

Commit

Permalink
Add goal dispatch to ReviewEntries update dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec committed Nov 6, 2023
1 parent a25f160 commit 05ec274
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Sense } from "api/models";
import * as backend from "backend";
import { addEntryEditToGoal } from "components/GoalTimeline/Redux/GoalActions";
import { uploadFileFromUrl } from "components/Pronunciations/utilities";
import {
ReviewClearReviewEntriesState,
Expand Down Expand Up @@ -30,15 +31,15 @@ export function updateAllWords(words: ReviewEntriesWord[]): ReviewUpdateWords {
};
}

// TODO: also dispatch(addEntryEditToGoal({newId: updatedWord.id, oldId}))
function updateWord(
oldId: string,
updatedWord: ReviewEntriesWord
): ReviewUpdateWord {
return {
type: ReviewEntriesActionTypes.UpdateWord,
oldId,
updatedWord,
function updateWord(oldId: string, updatedWord: ReviewEntriesWord) {
return (dispatch: StoreStateDispatch) => {
dispatch(addEntryEditToGoal({ newId: updatedWord.id, oldId }));
const update: ReviewUpdateWord = {
type: ReviewEntriesActionTypes.UpdateWord,
oldId,
updatedWord,
};
dispatch(update);
};
}

Expand Down

0 comments on commit 05ec274

Please sign in to comment.