mastoapi login works

This commit is contained in:
Henry Jameson 2019-05-21 23:35:40 +03:00
parent 233506f6c1
commit fc12b63fcc
3 changed files with 25 additions and 5 deletions

View file

@ -1,5 +1,4 @@
/* eslint-env browser */
const LOGIN_URL = '/api/account/verify_credentials.json'
const REGISTRATION_URL = '/api/account/register.json'
const BG_UPDATE_URL = '/api/qvitter/update_background_image.json'
const EXTERNAL_PROFILE_URL = '/api/externalprofile/show.json'
@ -17,6 +16,7 @@ const ACTIVATION_STATUS_URL = screenName => `/api/pleroma/admin/users/${screenNa
const ADMIN_USERS_URL = '/api/pleroma/admin/users'
const SUGGESTIONS_URL = '/api/v1/suggestions'
const MASTODON_LOGIN_URL = '/api/v1/accounts/verify_credentials'
const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites'
const MASTODON_USER_NOTIFICATIONS_URL = '/api/v1/notifications'
const MASTODON_FAVORITE_URL = id => `/api/v1/statuses/${id}/favourite`
@ -497,8 +497,7 @@ const fetchPinnedStatuses = ({ id, credentials }) => {
}
const verifyCredentials = (user) => {
return fetch(LOGIN_URL, {
method: 'POST',
return fetch(MASTODON_LOGIN_URL, {
headers: authHeaders(user)
})
.then((response) => {
@ -510,6 +509,7 @@ const verifyCredentials = (user) => {
}
}
})
.then((data) => data.error ? data : parseUser(data))
}