We are recommended to pass in an array of messages to expo server, to reduce the number of requests being made.
However, when I make a request where there is an array, the response object only displays one element.
I think this has to do with:
def extract_data(response)
response.fetch('data').first
end
Is there a reason for this? Why not simply return response.fetch('data')
Even better, it may be a good idea to do:
def extract_data(response)
data = response.fetch('data')
(data.class == Hash) ? [data] : data
end
So we can always expect an array response.
I'm not sure if I'm missing something, which is why I'm posting here.
We are recommended to pass in an array of messages to expo server, to reduce the number of requests being made.
However, when I make a request where there is an array, the response object only displays one element.
I think this has to do with:
Is there a reason for this? Why not simply return
response.fetch('data')Even better, it may be a good idea to do:
So we can always expect an array response.
I'm not sure if I'm missing something, which is why I'm posting here.