Fork me on GitHub
#re-frame
<
2017-03-05
>
lorenlarsen04:03:22

I'm having a strange problem and wondering if anyone has any quick ideas on a problem I'm having...If I run the following code from figwheel it works fine.

lorenlarsen04:03:23

(ajax-request {:uri "http://10.211.55.4:3000/api/session" :method :get :params {:scode "A1B2C3"} :format (url-request-format) :response-format (json-response-format) :timeout 5000 :handler #(dispatch [:good-http-result %1])})

lorenlarsen04:03:40

If I run it from inside my handler the request always times out.

lorenlarsen04:03:20

I've used reg-event-fx as well it will always timeout.

nrako04:03:40

That does seem a bit strange. What happens if you try curl from the command line?

lorenlarsen05:03:32

That works fine.

lorenlarsen05:03:06

I'm running the server on a Linux VM and I should also add that this is a react native project running on my Mac.

lorenlarsen05:03:10

and as it turns out it only happens when running on my actual iOS device. The simulator works fine. I normally don't develop with the simulator because I use the camera a lot in my app.

isak15:03:05

@victorvoid are you listening to history changes? .e.g.,:

(e/listen history h/EventType.NAVIGATE
                (fn [e]
                  (my-nav-function (token->location (.-token e)))))

andrea.crotti15:03:45

I'm noticing something really strange with this event

andrea.crotti15:03:06

ini short if I load the page and just trigger that event nothing happens

andrea.crotti15:03:21

then I go to the events.cljs file, I reload it

andrea.crotti15:03:23

and then it works

andrea.crotti15:03:37

can't figure out what's going on with it

andrea.crotti15:03:03

is there a reason why the event would not be triggered the first time?

isak15:03:05

@andrea.crotti are you missing scrabble.events in a require?

isak15:03:36

nm, i see you have it in core

andrea.crotti15:03:00

It's odd all the other work fine

andrea.crotti15:03:12

This is the only one doing an http request though

andrea.crotti16:03:42

I can probably try the second way of defining this event