Skip to content

Commit

Permalink
Добавил кэширование фоток в заметке
Browse files Browse the repository at this point in the history
  • Loading branch information
YarikMix committed May 16, 2024
1 parent e291406 commit e0ee029
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions public/src/components/Editor/Plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1071,18 +1071,24 @@ const RenderSubNote = (subNoteId:string) => {

subNoteWrapper.appendChild(subNoteContainer)

AppNoteRequests.Get(subNoteId, AppUserStore.state.JWT).then(result => {
if (result.data.title == null) {
subNoteTitle.innerHTML = 'Подзаметка'
}
if (subNoteId in AppNoteStore.state.cache) {
subNoteTitle.innerHTML = AppNoteStore.state.cache[subNoteId]
} else {
AppNoteRequests.Get(subNoteId, AppUserStore.state.JWT).then(result => {
if (result.data.title == null) {
subNoteTitle.innerHTML = 'Подзаметка'
}

//subNoteWrapper.dataset.title = parseNoteTitle(result.data.title)
subNoteTitle.innerHTML = parseNoteTitle(result.data.title)
//subNoteWrapper.dataset.title = parseNoteTitle(result.data.title)
subNoteTitle.innerHTML = parseNoteTitle(result.data.title)

}).catch((e) => {
subNoteTitle.innerHTML = "Заметка не найдена"
subNoteWrapper.dataset.deleted = "true"
});
AppDispatcher.dispatch(NoteStoreActions.PUT_TO_CACHE, {key: subNoteId, value: parseNoteTitle(result.data.title)})

}).catch((e) => {
subNoteTitle.innerHTML = "Заметка не найдена"
subNoteWrapper.dataset.deleted = "true"
});
}

let loading = true

Expand Down

0 comments on commit e0ee029

Please sign in to comment.