Merge pull request #15982 from overleaf/jel-dictionary-unlearn

[web] Only remove dictionary word from UI if unlearn request is successful

GitOrigin-RevId: 03fdeb39d43892690055efcdfafb22cf89550383
This commit is contained in:
Jessica Lawshe
2023-12-07 09:04:18 +00:00
committed by Copybot
parent da606cd9b8
commit ffd328e906
2 changed files with 13 additions and 5 deletions
@@ -23,14 +23,17 @@ export default function DictionaryModalContent({
const handleRemove = useCallback(
word => {
ignoredWords.remove(word)
runAsync(
postJSON('/spelling/unlearn', {
body: {
word,
},
})
).catch(debugConsole.error)
)
.then(() => {
ignoredWords.remove(word)
})
.catch(debugConsole.error)
},
[runAsync]
)