Fork me on GitHub
#reitit
<
2020-04-04
>
Ivan Fedorov17:04:15

Hi fellas! Anyone has experience with using reitit in browser? I was following the frontend example

(def r1
  (r-fr/router
    [["/app/page/{page-id}"
      {:name ::page1
       :parameters
       {:path {:page-id keyword?}
        :query {(ds/opt :foo) string?}}}]]
    {:data {:coercion rss/coercion}}))

(r/match-by-path r1 "/app/page/timeflow")
(r/match-by-path r1 "/app/page/timeflow?foo=sss")
So for me the second match results in
#reitit.core.Match{:template "/app/page/{page-id}",
                   :data {:coercion #object[reitit.coercion.spec.t_reitit$coercion$spec36831],
                          :name :facade.routes/page1,
                          :parameters {:path {:page-id #object[cljs$core$keyword_QMARK_]},
                                       :query {#spec-tools.data-spec.OptionalKey{:k :foo} #object[cljs$core$string_QMARK_]}}},
                   :result {:path #object[Function], :query #object[Function]},
                   :path-params {:page-id "timeflow?foo=sss"},
                   :path "/app/page/timeflow?foo=sss"}

Ivan Fedorov17:04:31

Question being – what should I do to have the query parsed?

juhoteperi17:04:03

@ognivo Call reitit.frontend/match-by-path instead of one from reitit.core