1
0
mirror of https://github.com/mgerb/classic-wow-forums synced 2026-01-10 09:02:50 +00:00

client - user account page done

This commit is contained in:
2018-01-13 00:31:01 -06:00
parent 57663b802c
commit e9d46ed5ce
12 changed files with 306 additions and 110 deletions

View File

@@ -45,7 +45,12 @@ defmodule MyApp.BattleNet.User do
defp parse_character_response({:ok, %HTTPoison.Response{body: body}}, user_id) do
case Poison.decode(body) do
{:ok, data} ->
Cachex.set(:myapp, "usr_char:#{user_id}", data, ttl: :timer.minutes(10)) # 10 minutes
# only cache end point if characters return
if (!data["characters"]) do
{:error, data}
else
Cachex.set(:myapp, "usr_char:#{user_id}", data, ttl: :timer.minutes(10)) # 10 minutes
end
{:ok, data}
{:error, error} -> {:error, error}
end