diff --git a/src/Internal/Api/SetAccountData/Api.elm b/src/Internal/Api/SetAccountData/Api.elm index 5225c65..783fb46 100644 --- a/src/Internal/Api/SetAccountData/Api.elm +++ b/src/Internal/Api/SetAccountData/Api.elm @@ -29,7 +29,8 @@ setAccountDataV1 { content, eventType, roomId } context = R.callApi "PUT" "/_matrix/client/r0/user/{userId}/account_data/{type}" ) >> R.withAttributes - [ R.replaceInUrl "type" eventType + [ R.accessToken + , R.replaceInUrl "type" eventType , R.replaceInUrl "userId" (Context.getUserId context) , R.fullBody content ] @@ -48,7 +49,8 @@ setAccountDataV2 { content, eventType, roomId } context = R.callApi "PUT" "/_matrix/client/v3/user/{userId}/account_data/{type}" ) >> R.withAttributes - [ R.replaceInUrl "type" eventType + [ R.accessToken + , R.replaceInUrl "type" eventType , R.replaceInUrl "userId" (Context.getUserId context) , R.fullBody content ] diff --git a/src/Internal/Vault.elm b/src/Internal/Vault.elm index 14afe1e..3ae756c 100644 --- a/src/Internal/Vault.elm +++ b/src/Internal/Vault.elm @@ -334,6 +334,9 @@ 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 -}