Fix token refresh error
This commit is contained in:
parent
0a2b7a9892
commit
2bc2c935ef
1 changed files with 6 additions and 2 deletions
|
@ -79,8 +79,12 @@ defmodule GeoTherminator.PumpAPI.Auth.Server do
|
||||||
|
|
||||||
if diff < @token_check_diff do
|
if diff < @token_check_diff do
|
||||||
Logger.debug("Renewing auth token since #{diff} < #{@token_check_diff}")
|
Logger.debug("Renewing auth token since #{diff} < #{@token_check_diff}")
|
||||||
user = Auth.API.auth(state.username, state.password)
|
|
||||||
|
with {:ok, user} <- Auth.API.auth(state.username, state.password) do
|
||||||
{:noreply, %State{state | authed_user: user}}
|
{:noreply, %State{state | authed_user: user}}
|
||||||
|
else
|
||||||
|
_ -> {:noreply, state}
|
||||||
|
end
|
||||||
else
|
else
|
||||||
{:noreply, state}
|
{:noreply, state}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue