Keep search query on reload
This commit is contained in:
@@ -57,10 +57,11 @@ class NoteController(
|
||||
}
|
||||
|
||||
fun search(request: Request, jwtPayload: JwtPayload): Response {
|
||||
val terms = request.searchTerms()
|
||||
val query = request.form("search") ?: ""
|
||||
val terms = parseSearchTerms(query)
|
||||
val notes = noteService.search(jwtPayload.userId, terms)
|
||||
val deletedCount = noteService.countDeleted(jwtPayload.userId)
|
||||
return Response(OK).html(view.search(jwtPayload, notes, deletedCount))
|
||||
return Response(OK).html(view.search(jwtPayload, notes, query, deletedCount))
|
||||
}
|
||||
|
||||
fun note(request: Request, jwtPayload: JwtPayload): Response {
|
||||
@@ -132,6 +133,4 @@ class NoteController(
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun Request.searchTerms(): SearchTerms = parseSearchTerms(form("search") ?: "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user