Closed amitaibu closed 6 years ago
If you don't have an access token, you don't have to call checkCachedCredentials
at all ... you can start with loggedOut
.
Indeed, but since this will almost always be the case, we can instead of
( loginStatus, loginCmd ) =
-- We kick off the process of checking the cached credentials which
-- we were provided.
case flags.accessToken of
Just accessToken ->
Restful.Login.checkCachedCredentials
loginConfig
flags.backendUrl
accessToken
Nothing ->
( Restful.Login.AnonymousUser Nothing ()
, Cmd.none
)
do the "heavy lifting" and
-- We kick off the process of checking the cached credentials which
-- we were provided, or default to Logged out.
( loginStatus, loginCmd ) =
Restful.Login.checkCachedCredentials
loginConfig
flags.backendUrl
flags.accessToken -- <- This is a Maybe
Ah, yes, that does seem nicer ...
I've added this change to #11.
Merged in #11.
This will allow us to prevent calling the server is we have no access token