databag/app/mobile/api/getUsername.js

13 lines
367 B
JavaScript
Raw Normal View History

2022-09-07 07:32:06 +00:00
import { checkResponse, fetchWithTimeout } from './fetchUtil';
export async function getUsername(name, token) {
let access = "";
if (token) {
access = `&token=${token}`
}
let available = await fetchWithTimeout('/account/username?name=' + encodeURIComponent(name) + access, { method: 'GET' })
checkResponse(available)
return await available.json()
}