mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 20:49:16 +00:00
13 lines
367 B
JavaScript
13 lines
367 B
JavaScript
|
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()
|
||
|
}
|
||
|
|