Fix token refresh error

This commit is contained in:
Mikko Ahlroth 2022-09-13 07:54:09 +03:00
parent 0a2b7a9892
commit 2bc2c935ef

View file

@ -79,8 +79,12 @@ defmodule GeoTherminator.PumpAPI.Auth.Server do
if diff < @token_check_diff do
Logger.debug("Renewing auth token since #{diff} < #{@token_check_diff}")
user = Auth.API.auth(state.username, state.password)
{:noreply, %State{state | authed_user: user}}
with {:ok, user} <- Auth.API.auth(state.username, state.password) do
{:noreply, %State{state | authed_user: user}}
else
_ -> {:noreply, state}
end
else
{:noreply, state}
end