reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
Ivan Fedorov 2020-04-04T17:13:15.043300Z

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 Fedorov 2020-04-04T17:15:31.044200Z

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

juhoteperi 2020-04-04T17:25:03.044600Z

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

Ivan Fedorov 2020-04-04T17:49:26.045300Z

@juhoteperi worked! Thanks!