Fork me on GitHub
#clojurescript
<
2018-05-03
>
sova-soars-the-sora07:05:56

is it possible to get refrisk to show me the application state atom for my om.next project?

pesterhazy12:05:58

@sova the data structure widget in re-frisk is datafrisk: https://github.com/Odinodin/data-frisk-reagent

pesterhazy12:05:33

you could probably use it from Om.next, but you'd need to pull in reagent and use reactify-component

chadhs19:05:41

does anyone have much experience with https://github.com/JulianBirch/cljs-ajax ? i can hit https://jsonplaceholder.typicode.com/users and get a response back via curl or a GET call with the library above, but when i try to hit darksky’s weather api it get “request failed” but using the same string it get a response back via curl :thinking_face:

captainlexington19:05:40

Could be a CORS issue. I'm pretty bad at those.

chadhs19:05:39

contents of the url string shouldn’t be an issue right? some things redacted to protect the innocent 🙂

""

justinlee20:05:32

@chadhs i’ve just switched to using it. i agree that it sounds like a cors issue

chadhs20:05:45

@lee.justin.m forgive my ignorance but if i’m just making a single call how is that cross-origin resource sharing? kinda bummed because im not seeing how i can call darksky’s api as they have CORS disabled

justinlee20:05:13

@chadhs not sure how the darksky api works, but if you serve from one domain (say, localhost) and then request from another (say, darksky), the darksky headers need to allow cross-origin requests in their headers. is there some kind of cookie or token you are supposed to be sending? maybe setting the with-credentials boolean is what you need?

justinlee20:05:58

the reason i suspect cors is because it works in curl but not in the browser

chadhs20:05:02

in the url above the def00.... is the api key

chadhs20:05:02

@lee.justin.m it works in browser and via curl but not calling via the GET function from cljs-ajax

justinlee20:05:57

you got it working from a browser using a different library? because looking at the FAQ, I’m having a hard time understanding how that could ever work: `We disable CORS to help keep your API secret key a secret. To prevent API key abuse, you should set up a proxy server to make calls to our API behind the scenes. Then you can provide forecasts to your clients without exposing your API key.`

chadhs20:05:16

oh i meant pasting the url in browser; which is about the same as a curl i thought

justinlee20:05:41

right that would work because it isn’t cross-origin if you do a direct url request

justinlee20:05:48

i think that because the api encodes the secret key in the url, they simply don’t want you to make the call from the browser at all or you’d end up leaking your key. you are supposed to set up an endpoint on the server which relays the information

captainlexington20:05:33

Oh hey, that explains what was going on with an API I was using a few weeks ago...

captainlexington20:05:37

That makes sense

captainlexington20:05:43

Hey, thanks!

👍 4
chadhs20:05:06

@lee.justin.m so a client only app wouldn’t work for this?

justinlee20:05:24

@chadhs I don’t see how.

chadhs20:05:45

@lee.justin.m so it could just be a simple single endpoint ring app and have the client app call that endpoint? am i understanding this correctly?

justinlee20:05:35

I think so: I think you just need to just take the coordinates, generate a url with the secret key, then return the results. You won’t have a cors issue because your server will just ignore it

chadhs20:05:09

gotcha. i can see why, but bummed it can’t be client only. was running this locally only. >.<