I'm connecting a to an Extrenal Server. After going through proper authorization process I get the reponse JSON object.
I'm now trying to display this JSON in view.
Here what I have done so far.
My first Action (which is called from Javascript that initiates Authorization process and fetches the data):
connect_external('POST',[])->
ExternalData = get_external_data(),
io:format("External Data Summary for put~n~p~n", [ExternalData]),
put(?MY_EXTERNAL_DATA, ExternalData).
In the second action (Javascript redirection to the display page) :
my_own_data('GET',[])->
MyData = get(?MY_EXTERNAL_DATA),
io:format("External Data Summary for get~n~p~n", [MyData]),
{ok, [{mydata, MyData}]}.
My aim is to display the JSON object in the view. But I don't see it. It's because get() call fails (put is successful as I can print the JSON) and in console I get:
External Data Summary for get
undefined
I'm very new to ChicagoBoss/Erlang. Any help would really appreciated. Should I use process dictionary at all? If not what is the altenative approach?
As pointed out by Anthony Kong, I have solved this problem using boss_session:set_session_data(...) and boss_session:get_session_data().