From 55c76db7b60ae142a1d224e4d485771d7be2b51f Mon Sep 17 00:00:00 2001
From: Ilion Beyst <ilion.beyst@gmail.com>
Date: Tue, 25 Oct 2022 18:57:58 +0200
Subject: fix matches page filter params propagation

---
 web/pw-server/src/routes/matches/index.svelte | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

(limited to 'web/pw-server/src/routes/matches/index.svelte')

diff --git a/web/pw-server/src/routes/matches/index.svelte b/web/pw-server/src/routes/matches/index.svelte
index 8c106fa..9679132 100644
--- a/web/pw-server/src/routes/matches/index.svelte
+++ b/web/pw-server/src/routes/matches/index.svelte
@@ -8,11 +8,18 @@
       const apiClient = new ApiClient(fetch);
       const botName = url.searchParams.get("bot");
 
+      let searchParams = removeUndefined({
+        bot: url.searchParams.get("bot"),
+        opponent: url.searchParams.get("opponent"),
+        outcome: url.searchParams.get("outcome"),
+        had_errors: url.searchParams.get("had_errors"),
+      });
+
       let query = {
         count: PAGE_SIZE,
         before: url.searchParams.get("before"),
         after: url.searchParams.get("after"),
-        bot: botName,
+        ...searchParams,
       };
 
       let { matches, has_next } = await apiClient.get("/api/matches", removeUndefined(query));
@@ -28,6 +35,7 @@
           botName,
           hasNext: has_next,
           query,
+          searchParams,
         },
       };
     } catch (error) {
@@ -57,6 +65,7 @@
   // whether a next page exists in the current iteration direction (before/after)
   export let hasNext: boolean;
   export let query: object;
+  export let searchParams: object;
 
   type Cursor = {
     before?: string;
@@ -65,6 +74,7 @@
 
   function pageLink(cursor: Cursor) {
     let paramsObj = {
+      ...searchParams,
       ...cursor,
     };
     if (botName) {
-- 
cgit v1.2.3

