Skip to content

Commit

Permalink
fix pagination query params
Browse files Browse the repository at this point in the history
  • Loading branch information
Mebareksaf committed Feb 28, 2024
1 parent b0dbbb1 commit 5395392
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/ex_nvr_web/lib/ex_nvr_web/live/recordings_list_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ defmodule ExNVRWeb.RecordingListLive do

cursor_params =
if not is_nil(after_cursor) do
old_pagination_params = Map.drop(socket.assigns.pagination_params, ["before"])
Map.merge(old_pagination_params, %{"after" => after_cursor})
old_pagination_params = Map.drop(socket.assigns.pagination_params, ["before", "before-cursor", "last"])
Map.merge(old_pagination_params, %{"first" => 100, "after" => after_cursor})
else
old_pagination_params = Map.drop(socket.assigns.pagination_params, ["after"])
Map.merge(old_pagination_params, %{"before" => before_cursor})
old_pagination_params = Map.drop(socket.assigns.pagination_params, ["after", "after-cursor", "first"])
Map.merge(old_pagination_params, %{"last" => 100, "before" => before_cursor})
end

pagination_params = Map.merge(pagination_params, cursor_params)
Expand Down

0 comments on commit 5395392

Please sign in to comment.