mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 03:27:05 -04:00
changed calls to cy.route to cy.intercept (#806)
Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
bc7ff07256
commit
e0dbb05572
5 changed files with 87 additions and 49 deletions
|
@ -153,21 +153,25 @@ export const HistoryPage: React.FC = () => {
|
|||
})
|
||||
})
|
||||
} else if (location === HistoryEntryOrigin.REMOTE) {
|
||||
const entry = remoteHistoryEntries.find(entry => entry.id === entryId)
|
||||
if (!entry) {
|
||||
const foundEntry = remoteHistoryEntries.find(entry => entry.id === entryId)
|
||||
if (!foundEntry) {
|
||||
setError('notFoundEntry')
|
||||
return
|
||||
}
|
||||
entry.pinned = !entry.pinned
|
||||
updateHistoryEntry(entryId, entry)
|
||||
.then(() => setRemoteHistoryEntries((entries) => {
|
||||
return entries.map((entry) => {
|
||||
if (entry.id === entryId) {
|
||||
entry.pinned = !entry.pinned
|
||||
}
|
||||
return entry
|
||||
})
|
||||
}))
|
||||
const changedEntry = {
|
||||
...foundEntry,
|
||||
pinned: !foundEntry.pinned
|
||||
}
|
||||
updateHistoryEntry(entryId, changedEntry)
|
||||
.then(() => setRemoteHistoryEntries((entries) => (
|
||||
entries.map((entry) => {
|
||||
if (entry.id === entryId) {
|
||||
entry.pinned = !entry.pinned
|
||||
}
|
||||
return entry
|
||||
})
|
||||
)
|
||||
))
|
||||
.catch(() => setError('updateEntry'))
|
||||
}
|
||||
}, [remoteHistoryEntries])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue