diff --git a/public/src/modules/stores/NotesStore.ts b/public/src/modules/stores/NotesStore.ts index b77693b4..373a72e2 100644 --- a/public/src/modules/stores/NotesStore.ts +++ b/public/src/modules/stores/NotesStore.ts @@ -95,52 +95,22 @@ class NotesStore extends BaseStore { this.invitesWS = new WebSocketConnection(`note/subscribe/on_invites`) - this.invitesWS.onOpen(() => { - console.log("invitesWS.onOpen") - // this.editorWS.sendMessage(JSON.stringify({ - // type: "opened", - // note_id: note.id, - // user_id: AppUserStore.state.user_id, - // username: AppUserStore.state.username, - // image_path: AppUserStore.state.avatarUrl - // })) - }) - - this.invitesWS.onMessage((event) => { - console.log("invitesWS.onMessage") - + this.invitesWS.onMessage(async (event) => { let data = JSON.parse(event.data) - console.log(data) - if (data.type == "invite") { - const owner = data.owner - AppToasts.info(owner + " пригласил вас в свою заметку!") - - const note:NoteType = { - "id": data.note_id, - "data": { - "title": data.note_title.replace('"', ""), - "content": [] - }, - "update_time": data.created, - "owner_id": null, - "parent": "00000000-0000-0000-0000-000000000000", - "children": [], - "tags": [], - "collaborators": [], - "icon": "", - "header": "", - "favorite": false, - "public": false - } + try { + const note = await AppNoteRequests.Get(data.note_id, AppUserStore.state.JWT) - this.SetState(state => ({ - ...state, - // offset: state.offset + 1, ? - notes: [note, ...state.notes] - })); + AppToasts.info(data.owner + " пригласил вас в свою заметку!") + this.SetState(state => ({ + ...state, + notes: [note, ...state.notes] + })); + } catch { + AppToasts.error("Что-то пошло не так") + } } }) diff --git a/public/src/utils/variables.sass b/public/src/utils/variables.sass index ecabf098..eed7008a 100644 --- a/public/src/utils/variables.sass +++ b/public/src/utils/variables.sass @@ -24,5 +24,5 @@ $xs: 320px $sm: 576px $md: 768px $lg: 992px -$xl: 1240px +$xl: 1275px $xxl: 1650px \ No newline at end of file