File tree Expand file tree Collapse file tree
packages/schemas/src/auth Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /* eslint-disable perfectionist/sort-objects */
2+
3+ import { Form } from '@douglasneuroinformatics/libui/components' ;
4+ import { $LoginCredentials } from '@opendatacapture/schemas/auth' ;
5+
6+ type LoginFormProps = {
7+ onSubmit : ( credentials : $LoginCredentials ) => void ;
8+ } ;
9+
10+ export const LoginForm = ( { onSubmit } : LoginFormProps ) => {
11+ return (
12+ < Form
13+ content = { {
14+ username : {
15+ kind : 'string' ,
16+ label : 'Username' ,
17+ variant : 'input'
18+ } ,
19+ password : {
20+ kind : 'string' ,
21+ label : 'Password' ,
22+ variant : 'password'
23+ }
24+ } }
25+ submitBtnLabel = "Login"
26+ validationSchema = { $LoginCredentials }
27+ onSubmit = { onSubmit }
28+ />
29+ ) ;
30+ } ;
Original file line number Diff line number Diff line change 1+ export * from './LoginForm' ;
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ export type AuthPayload = {
1010
1111export type $LoginCredentials = z . infer < typeof $LoginCredentials > ;
1212export const $LoginCredentials = z . object ( {
13- password : z . string ( ) ,
14- username : z . string ( )
13+ password : z . string ( ) . min ( 1 ) ,
14+ username : z . string ( ) . min ( 1 )
1515} ) ;
1616
1717export type TokenPayload = {
You can’t perform that action at this time.
0 commit comments