Add OAuth Tokens management to settings
This commit is contained in:
parent
058238c3c6
commit
2c7406d9a8
25 changed files with 208 additions and 1 deletions
|
@ -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,
|
||||
|
|
|
@ -65,6 +65,8 @@ const backendInteractorService = (credentials) => {
|
|||
const fetchMutes = () => apiService.fetchMutes({credentials})
|
||||
const fetchBlocks = (params) => apiService.fetchBlocks({credentials, ...params})
|
||||
const fetchFollowRequests = () => apiService.fetchFollowRequests({credentials})
|
||||
const fetchOAuthTokens = () => apiService.fetchOAuthTokens({credentials})
|
||||
const revokeOAuthToken = (id) => apiService.revokeOAuthToken({id, credentials})
|
||||
|
||||
const getCaptcha = () => apiService.getCaptcha()
|
||||
const register = (params) => apiService.register(params)
|
||||
|
@ -96,6 +98,8 @@ const backendInteractorService = (credentials) => {
|
|||
setUserMute,
|
||||
fetchMutes,
|
||||
fetchBlocks,
|
||||
fetchOAuthTokens,
|
||||
revokeOAuthToken,
|
||||
register,
|
||||
getCaptcha,
|
||||
updateAvatar,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue