This commit is contained in:
Athou
2024-08-07 08:10:14 +02:00
parent 2f6ddf0e70
commit cc32f8ad16
164 changed files with 2011 additions and 3288 deletions

View File

@@ -24,12 +24,18 @@ export function RegistrationPage() {
},
})
const register = useAsyncCallback(client.user.register, {
const login = useAsyncCallback(client.user.login, {
onSuccess: () => {
dispatch(redirectToRootCategory())
},
})
const register = useAsyncCallback(client.user.register, {
onSuccess: () => {
login.execute(form.values)
},
})
return (
<Container size="xs">
<PageTitle />
@@ -50,6 +56,12 @@ export function RegistrationPage() {
</Box>
)}
{login.error && (
<Box mb="md">
<Alert messages={errorToStrings(login.error)} />
</Box>
)}
<form onSubmit={form.onSubmit(register.execute)}>
<Stack>
<TextInput label="User Name" placeholder="User Name" {...form.getInputProps("name")} size="md" required />
@@ -68,7 +80,7 @@ export function RegistrationPage() {
size="md"
required
/>
<Button type="submit" loading={register.loading}>
<Button type="submit" loading={register.loading || login.loading}>
<Trans>Sign up</Trans>
</Button>
<Center>