Pinafore-Web-Client-Frontend/routes/_api/user.js

20 lines
754 B
JavaScript
Raw Normal View History

2018-02-24 03:23:36 +01:00
import { getWithTimeout, paramsString } from '../_utils/ajax'
2018-02-24 23:49:28 +01:00
import { auth, basename } from './utils'
2018-01-13 23:19:51 +01:00
2018-02-09 07:29:29 +01:00
export function getVerifyCredentials (instanceName, accessToken) {
let url = `${basename(instanceName)}/api/v1/accounts/verify_credentials`
2018-02-24 23:49:28 +01:00
return getWithTimeout(url, auth(accessToken))
2018-01-23 06:16:27 +01:00
}
2018-02-09 07:29:29 +01:00
export function getAccount (instanceName, accessToken, accountId) {
2018-01-23 06:16:27 +01:00
let url = `${basename(instanceName)}/api/v1/accounts/${accountId}`
2018-02-24 23:49:28 +01:00
return getWithTimeout(url, auth(accessToken))
2018-01-28 21:51:48 +01:00
}
2018-02-09 07:29:29 +01:00
export async function getRelationship (instanceName, accessToken, accountId) {
2018-01-28 21:51:48 +01:00
let url = `${basename(instanceName)}/api/v1/accounts/relationships`
url += '?' + paramsString({id: accountId})
2018-02-24 23:49:28 +01:00
let res = await getWithTimeout(url, auth(accessToken))
2018-01-28 21:51:48 +01:00
return res[0]
2018-02-09 07:29:29 +01:00
}