fix(web): fix behavior on getting no quotes
This commit is contained in:
parent
838f089c69
commit
b3090f5dc0
@ -121,6 +121,7 @@ func QuotesGet(ctx context.Context, user_id string, filter string, sort string,
|
||||
err = fmt.Errorf("error while getting quotes: %w", err)
|
||||
return
|
||||
}
|
||||
quotes = []models.Quote{}
|
||||
for rows.Next() {
|
||||
var quote models.Quote
|
||||
err = rows.Scan("e.ID, "e.Text, "e.Author, "e.Datetime, "e.Creator.ID, "e.Creator.Name, "e.Creator.Login, "e.Creator.Role, "e.Creator.TelegramID)
|
||||
|
||||
@ -95,6 +95,10 @@ function load() {
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
if (resp.length == 0) {
|
||||
container.html("<p style='text-align: center;'><i>Чёт нету ничего...</i></p>");
|
||||
return;
|
||||
}
|
||||
resp.forEach((quote) => {
|
||||
container.append(renderBlockQuote(quote));
|
||||
});
|
||||
@ -130,6 +134,10 @@ $(window).on("load", function (e) {
|
||||
|
||||
$(document).on("click", "#btn-refresh", function (e) {
|
||||
search = $("#input-search").val();
|
||||
if (search != "") {
|
||||
currPage = 1;
|
||||
sessionStorage.setItem("search", currPage);
|
||||
}
|
||||
sorting = $("#input-sorting option:selected").val();
|
||||
reload();
|
||||
sessionStorage.setItem("search", search);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user