mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 02:06:29 +00:00
rebase and prefer const in node list
This commit is contained in:
@@ -681,13 +681,14 @@ class NoteList extends React.Component {
|
|||||||
const selectedNotes = findNotesByKeys(notes, selectedNoteKeys)
|
const selectedNotes = findNotesByKeys(notes, selectedNoteKeys)
|
||||||
const firstNote = selectedNotes[0]
|
const firstNote = selectedNotes[0]
|
||||||
const config = ConfigManager.get()
|
const config = ConfigManager.get()
|
||||||
let {address, token, authMethod, username, password} = config.blog
|
const {address, token, authMethod, username, password} = config.blog
|
||||||
|
let authToken = ''
|
||||||
if (authMethod === 'USER') {
|
if (authMethod === 'USER') {
|
||||||
token = `Basic ${window.btoa(`${username}:${password}`)}`
|
authToken = `Basic ${window.btoa(`${username}:${password}`)}`
|
||||||
} else {
|
} else {
|
||||||
token = `Bearer ${token}`
|
authToken = `Bearer ${token}`
|
||||||
}
|
}
|
||||||
let contentToRender = firstNote.content.replace(`# ${firstNote.title}`, '')
|
const contentToRender = firstNote.content.replace(`# ${firstNote.title}`, '')
|
||||||
var data = {
|
var data = {
|
||||||
title: firstNote.title,
|
title: firstNote.title,
|
||||||
content: markdown.render(contentToRender),
|
content: markdown.render(contentToRender),
|
||||||
@@ -708,7 +709,7 @@ class NoteList extends React.Component {
|
|||||||
method: method,
|
method: method,
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': token,
|
'Authorization': authToken,
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
}
|
}
|
||||||
}).then(res => res.json())
|
}).then(res => res.json())
|
||||||
|
|||||||
Reference in New Issue
Block a user