databag/app/mobile/src/api/getHandle.js

9 lines
327 B
JavaScript
Raw Normal View History

import { checkResponse, fetchWithTimeout } from './fetchUtil';
export async function getHandle(server, token, name) {
let available = await fetchWithTimeout(`https://${server}/account/username?agent=${token}&name=${encodeURIComponent(name)}`, { method: 'GET' })
checkResponse(available)
return await available.json()
}