Skip to content

Commit 2b9d3f4

Browse files
committed
fix: join room modal upercase
1 parent ed63b24 commit 2b9d3f4

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

apps/web/src/app/(protected)/(dashboard-layout)/dashboard/_components/dashboard-private-room-modal.tsx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
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';
83
import { Noise } from '@/components/illustrations/noise';
94
import { Button } from '@/components/ui/button';
105
import {
@@ -24,20 +19,25 @@ import {
2419
FormLabel,
2520
FormMessage
2621
} from '@/components/ui/form';
22+
import { Input } from '@/components/ui/input';
2723
import {
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';
3330
import '@caho/contracts';
3431
import { useRouter } from 'next/navigation';
3532
import type { JoinRoomRequest, JoinRoomResponse } from '@caho/contracts';
3633
import type { ErrorSchema } from '@caho/schemas';
34+
import { zodResolver } from '@hookform/resolvers/zod';
3735
import { 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

4242
export const joinRoom = async (
4343
payload: JoinRoomRequest
@@ -51,9 +51,12 @@ export const joinRoom = async (
5151
};
5252

5353
const 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

Comments
 (0)