api: turn MASTODON_USER_URL into a function

This commit is contained in:
Sol Fisher Romanoff 2022-06-23 15:02:43 +03:00
parent fb2fc686b1
commit 4f0eabbd55
No known key found for this signature in database
GPG key ID: 9D3F2B64F2341B62

View file

@ -47,7 +47,7 @@ const MASTODON_PUBLIC_TIMELINE = '/api/v1/timelines/public'
const MASTODON_USER_HOME_TIMELINE_URL = '/api/v1/timelines/home'
const MASTODON_STATUS_URL = id => `/api/v1/statuses/${id}`
const MASTODON_STATUS_CONTEXT_URL = id => `/api/v1/statuses/${id}/context`
const MASTODON_USER_URL = '/api/v1/accounts'
const MASTODON_USER_URL = id => `/api/v1/accounts/${id}?with_relationships=true`
const MASTODON_USER_RELATIONSHIPS_URL = '/api/v1/accounts/relationships'
const MASTODON_USER_TIMELINE_URL = id => `/api/v1/accounts/${id}/statuses`
const MASTODON_LIST_URL = id => `/api/v1/lists/${id}`
@ -311,7 +311,7 @@ const denyUser = ({ id, credentials }) => {
}
const fetchUser = ({ id, credentials }) => {
let url = `${MASTODON_USER_URL}/${id}` + '?with_relationships=true'
const url = MASTODON_USER_URL(id)
return promisedRequest({ url, credentials })
.then((data) => parseUser(data))
}