Add OAuth Tokens management to settings

This commit is contained in:
Maxim Filippov 2019-02-12 21:53:59 +03:00
parent 058238c3c6
commit 2c7406d9a8
25 changed files with 208 additions and 1 deletions

View file

@ -531,6 +531,23 @@ const fetchBlocks = ({page, credentials}) => {
})
}
const fetchOAuthTokens = ({credentials}) => {
const url = '/api/oauth_tokens.json'
return fetch(url, {
headers: authHeaders(credentials)
}).then((data) => data.json())
}
const revokeOAuthToken = ({id, credentials}) => {
const url = `/api/oauth_tokens/${id}`
return fetch(url, {
headers: authHeaders(credentials),
method: 'DELETE'
})
}
const suggestions = ({credentials}) => {
return fetch(SUGGESTIONS_URL, {
headers: authHeaders(credentials)
@ -573,6 +590,8 @@ const apiService = {
setUserMute,
fetchMutes,
fetchBlocks,
fetchOAuthTokens,
revokeOAuthToken,
register,
getCaptcha,
updateAvatar,