11'use client' ;
22
3- import { zodResolver } from '@hookform/resolvers/zod' ;
4- import { REGEXP_ONLY_DIGITS_AND_CHARS } from 'input-otp' ;
5- import { Lock } from 'lucide-react' ;
6- import { useForm } from 'react-hook-form' ;
7- import * as z from 'zod' ;
83import { Noise } from '@/components/illustrations/noise' ;
94import { Button } from '@/components/ui/button' ;
105import {
@@ -24,20 +19,25 @@ import {
2419 FormLabel ,
2520 FormMessage
2621} from '@/components/ui/form' ;
22+ import { Input } from '@/components/ui/input' ;
2723import {
2824 InputOTP ,
2925 InputOTPGroup ,
3026 InputOTPSlot
3127} from '@/components/ui/input-otp' ;
32- import { DashboardOptionCard } from './dashboard-option-card' ;
28+ import { toast } from '@/components/ui/use-toast' ;
29+ import { api } from '@/utils/api' ;
3330import '@caho/contracts' ;
3431import { useRouter } from 'next/navigation' ;
3532import type { JoinRoomRequest , JoinRoomResponse } from '@caho/contracts' ;
3633import type { ErrorSchema } from '@caho/schemas' ;
34+ import { zodResolver } from '@hookform/resolvers/zod' ;
3735import { useMutation } from '@tanstack/react-query' ;
38- import { Input } from '@/components/ui/input' ;
39- import { toast } from '@/components/ui/use-toast' ;
40- import { api } from '@/utils/api' ;
36+ import { REGEXP_ONLY_DIGITS_AND_CHARS } from 'input-otp' ;
37+ import { Lock } from 'lucide-react' ;
38+ import { useForm } from 'react-hook-form' ;
39+ import * as z from 'zod' ;
40+ import { DashboardOptionCard } from './dashboard-option-card' ;
4141
4242export const joinRoom = async (
4343 payload : JoinRoomRequest
@@ -51,9 +51,12 @@ export const joinRoom = async (
5151} ;
5252
5353const formSchema = z . object ( {
54- roomCode : z . string ( ) . min ( 6 , {
55- message : 'O código da sala deve ter 6 dígitos.'
56- } ) ,
54+ roomCode : z
55+ . string ( )
56+ . min ( 6 , {
57+ message : 'O código da sala deve ter 6 dígitos.'
58+ } )
59+ . transform ( value => value . toUpperCase ( ) ) ,
5760 password : z . string ( ) . min ( 1 , {
5861 message : 'A senha da sala é obrigatória.'
5962 } )
@@ -81,7 +84,7 @@ export function DashboardPrivateRoomModal() {
8184 function onSubmit ( values : z . infer < typeof formSchema > ) {
8285 mutate ( values , {
8386 onSuccess : data => {
84- push ( `/room/${ data . code } ` ) ;
87+ push ( `/room/${ data . code . toUpperCase ( ) } ` ) ;
8588 } ,
8689 onError : error => {
8790 toast ( {
0 commit comments