From f363f3827569e9f3831ad9e281de41fdc47940c2 Mon Sep 17 00:00:00 2001 From: ronreg-ribdev <56719257+ronreg-ribdev@users.noreply.github.com> Date: Sun, 24 May 2020 02:02:12 -0700 Subject: [PATCH] Pass station json direct to frontend --- urbit/app/bartinfo.hoon | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/urbit/app/bartinfo.hoon b/urbit/app/bartinfo.hoon index 4db1e95..e4c7cc9 100644 --- a/urbit/app/bartinfo.hoon +++ b/urbit/app/bartinfo.hoon @@ -94,10 +94,11 @@ ~& "on-arvo wire: {}" ?: ?=(%http-response +<.sign-arvo) =/ http-moves=(list card) - =/ value %- pairs:enjs:format - :~ fulltext+s+(crip "{}") - == + ?+ wire ~ + [%bartstationrequest *] + =/ value=json (parse-request-stations-response:cc client-response.sign-arvo) [%give %fact ~[/primary] %json !>(value)]~ + == [http-moves this] ?. ?=(%bound +<.sign-arvo) (on-arvo:def wire sign-arvo) @@ -123,6 +124,19 @@ =/ headers [['Accept' 'application/json']]~ [%'GET' url headers *(unit octs)] :: +++ parse-request-stations-response + |= response=client-response:iris + ^- json + =/ pairs pairs:enjs:format + ?. ?=(%finished -.response) + %- pairs [fulltext+s+'bart response error' ~] + =/ data=(unit mime-data:iris) full-file.response + ?~ data %- pairs ~ + =/ ujon=(unit json) (de-json:html q.data.u.data) + ?~ ujon %- pairs ~ + =/ parsed-json u.ujon + parsed-json +:: ++ poke-handle-http-request |= =inbound-request:eyre ^- simple-payload:http