1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

fix: fix crash on /searched

Add routing for search word:

- `/searched/:searchword`

Restore the state from the `:searchword` params.
This commit is contained in:
azu
2018-03-25 00:33:57 +09:00
parent 02095ac155
commit 3b0f664a3b
3 changed files with 19 additions and 6 deletions

View File

@@ -326,8 +326,10 @@ class NoteList extends React.Component {
}
if (location.pathname.match(/\/searched/)) {
const searchInputText = document.getElementsByClassName('searchInput')[0].value
if (searchInputText === '') {
const searchInputText = params.searchword
const allNotes = data.noteMap.map((note) => note)
this.contextNotes = allNotes
if (searchInputText === undefined || searchInputText === '') {
return this.sortByPin(this.contextNotes)
}
return searchFromNotes(this.contextNotes, searchInputText)