diff --git a/public/src/modules/api.ts b/public/src/modules/api.ts index b9b28837..ecafd3ac 100644 --- a/public/src/modules/api.ts +++ b/public/src/modules/api.ts @@ -564,8 +564,6 @@ class NoteRequests { } ExportToZip = async (note_id:string, note: string, jwt:string, csrf:string) => { - console.log("ExportToZip") - const options: RequestInit = { method: RequestMethods.POST, body: note, @@ -579,12 +577,15 @@ class NoteRequests { const response = await fetch(baseUrl + "/note/" + note_id + "/make_zip", options); + console.log(response.headers['x-csrf-token']) + console.log(response) + if (response.status == 200) { const blob = await response.blob() return { url: URL.createObjectURL(blob), status: response.status, - csrf: response.headers['x-csrf-token'] + csrf: response.headers.get('x-csrf-token') }; } diff --git a/public/src/modules/stores/NotesStore.ts b/public/src/modules/stores/NotesStore.ts index 9216616e..c9360500 100644 --- a/public/src/modules/stores/NotesStore.ts +++ b/public/src/modules/stores/NotesStore.ts @@ -767,6 +767,8 @@ class NotesStore extends BaseStore { const note = document.querySelector(".note-editor-content").outerHTML const {url, csrf} = await AppNoteRequests.ExportToZip(this.state.selectedNote.id, note, AppUserStore.state.JWT, AppUserStore.state.csrf) + console.log(csrf) + AppDispatcher.dispatch(UserActions.UPDATE_CSRF, csrf); downloadFile(url, parseNoteTitle(AppNoteStore.state.note.title) + ".zip")