added missing file

This commit is contained in:
balzack 2024-08-12 20:16:01 +02:00
parent 5e145f8950
commit ce459b5672
2 changed files with 22 additions and 1 deletions

View File

@ -34,7 +34,6 @@ export function Access() {
actions.setLoading(true)
otpClose()
try {
await new Promise((r) => setTimeout(r, 2000))
if (state.mode === 'account') {
await actions.accountLogin()
} else if (state.mode === 'create') {
@ -95,6 +94,7 @@ export function Access() {
<TextInput
className={classes.input}
size="md"
value={state.username}
leftSectionPointerEvents="none"
leftSection={<IconUser />}
placeholder={state.strings.username}
@ -105,6 +105,7 @@ export function Access() {
<PasswordInput
className={classes.input}
size="md"
value={state.password}
leftSection={<IconLock />}
placeholder={state.strings.password}
onChange={(event) =>
@ -210,6 +211,7 @@ export function Access() {
<TextInput
className={classes.input}
size="md"
value={state.username}
leftSectionPointerEvents="none"
leftSection={<IconUser />}
placeholder={state.strings.username}
@ -221,6 +223,7 @@ export function Access() {
<PasswordInput
className={classes.input}
size="md"
value={state.password}
leftSection={<IconLock />}
placeholder={state.strings.password}
onChange={(event) =>
@ -230,6 +233,7 @@ export function Access() {
<PasswordInput
className={classes.input}
size="md"
value={state.confirm}
leftSection={<IconLock />}
placeholder={state.strings.confirmPassword}
onChange={(event) =>
@ -273,6 +277,7 @@ export function Access() {
<PasswordInput
className={classes.input}
size="md"
value={state.password}
leftSection={<IconLock />}
placeholder={state.strings.password}
onChange={(event) =>

View File

@ -0,0 +1,16 @@
import axios from 'redaxios';
export async function getUsername(name: string, token: string, node: string, secure: boolean): boolean {
const param = token ? `&token=${token}` : '';
const username = encodeURIComponent(name)
const endpoint = `http${secure ? 's' : ''}://${node}/account/username?name=${username}${param}`;
const response = await axios.get(endpoint);
if (response.status >= 400 && response.status < 600) {
throw new Error('getAvailable fetch failed');
}
if (typeof response.data !== 'boolean') {
throw new Error('getAvailable response failed');
}
return response.data;
}