elm-format

pull/1/head
Bram van den Heuvel 2023-04-05 12:50:15 +02:00
parent f18dbcc941
commit 70cbe5b682
4 changed files with 10 additions and 3 deletions

View File

@ -76,12 +76,14 @@ fromBaseUrl url =
, vs = Nothing
}
{-| Get the user id registered by the `Credentials` type.
-}
getUserId : Credentials -> Maybe String
getUserId (Credentials { access }) =
Login.getUserId access
{-| Retrieves the spec versions from a given `Credentials` value.
-}
versions : Credentials -> Maybe V.Versions

View File

@ -56,6 +56,7 @@ getToken t =
UsernameAndPassword { token } ->
token
getUserId : AccessToken -> Maybe String
getUserId t =
case t of
@ -71,6 +72,7 @@ getUserId t =
UsernameAndPassword { userId } ->
userId
addToken : String -> AccessToken -> AccessToken
addToken s t =
case t of

View File

@ -334,10 +334,12 @@ updateWith vaultUpdate ((Vault ({ cred, context } as data)) as vault) =
LoggedInWithUsernameAndPassword _ output ->
Vault { data | context = Credentials.addToken output.accessToken context }
getUsername : Vault -> Maybe String
getUsername (Vault { context }) =
Credentials.getUserId context
{-| Set personal account data
-}
setAccountData : String -> E.Value -> Vault -> Task X.Error VaultUpdate

View File

@ -137,6 +137,7 @@ accountData =
The username is a `Maybe String` if the Vault hasn't had its first sync yet,
and the API might not always be consistent on the username.
-}
username : Vault -> Maybe String
username =