corregido errores de compilacion para next en web

This commit is contained in:
2025-06-18 12:11:05 -04:00
parent a9a5dad0dd
commit 097eb7c8a2
29 changed files with 195 additions and 145 deletions

View File

@@ -2,7 +2,36 @@
import { safeFetchApi } from '@/lib';
import { loginResponseSchema, UserFormValue } from '../schemas/login';
export const SignInAction = async (payload: UserFormValue) => {
type LoginActionSuccess = {
message: string;
user: {
email: string;
username: string;
id: number;
rol: Array<{ id: number; rol: string }>;
fullname: string;
};
tokens: {
access_token: string;
access_expire_in: number;
refresh_token: string;
refresh_expire_in: number;
};
}
type LoginActionError = {
type: 'API_ERROR' | 'VALIDATION_ERROR' | 'UNKNOWN_ERROR'; // **Asegúrate de que el tipo de `type` sea este aquí**
message: string;
details?: any;
};
// Si SignInAction también puede devolver null, asegúralo en su tipo de retorno
type LoginActionResult = LoginActionSuccess | LoginActionError | null;
export const SignInAction = async (payload: UserFormValue): Promise<LoginActionResult> => {
const [error, data] = await safeFetchApi(
loginResponseSchema,
'/auth/sign-in',
@@ -10,7 +39,11 @@ export const SignInAction = async (payload: UserFormValue) => {
payload,
);
if (error) {
return error;
return {
type: error.type as 'API_ERROR' | 'VALIDATION_ERROR' | 'UNKNOWN_ERROR',
message: error.message,
details: error.details
};
} else {
return data;
}

View File

@@ -10,7 +10,6 @@ import {
FormMessage,
} from '@repo/shadcn/form';
import { Input } from '@repo/shadcn/input';
import { signIn } from 'next-auth/react';
import { useRouter, useSearchParams } from 'next/navigation';
import { useState, useTransition } from 'react';
import { useForm } from 'react-hook-form';
@@ -27,13 +26,10 @@ export default function UserAuthForm() {
const router = useRouter();
const searchParams = useSearchParams();
const callbackUrl = searchParams.get('callbackUrl');
const [loading, startTransition] = useTransition();
const [error, SetError] = useState<string | null>(null);
const [state, setState] = React.useState(0);
const [municipality, setMunicipality] = React.useState(0);
const [parish, setParish] = React.useState(0);
const [disabledMunicipality, setDisabledMunicipality] = React.useState(true);
const [disabledParish, setDisabledParish] = React.useState(true);

View File

@@ -3,7 +3,7 @@
import { useState } from 'react';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@repo/shadcn/card';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@repo/shadcn/select';
import { PieChart, Pie, Cell, ResponsiveContainer, Tooltip, Legend } from 'recharts';
import { PieChart, Pie, Cell, ResponsiveContainer, Tooltip } from 'recharts';
import { SurveyStatisticsData } from '../schemas/statistics';
interface SurveyDetailsProps {

View File

@@ -1,7 +1,7 @@
'use client';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@repo/shadcn/card';
import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer, PieChart, Pie, Cell } from 'recharts';
import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts';
import { SurveyStatisticsData } from '../schemas/statistics';
interface SurveyOverviewProps {

View File

@@ -1,6 +1,5 @@
'use client';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@repo/shadcn/card';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@repo/shadcn/tabs';
import { useSurveysStatsQuery } from '../hooks/use-query-statistics';
import { SurveyOverview } from './survey-overview';

View File

@@ -19,7 +19,7 @@ import {
} from '@repo/shadcn/card';
import { useRouter } from 'next/navigation';
import { useSurveysForUserQuery } from '@/feactures/surveys/hooks/use-query-surveys';
import { Survey, SurveyAnswerForUser } from '../schemas/survey';
import { SurveyAnswerForUser } from '../schemas/survey';
import { Badge } from '@repo/shadcn/badge';
import { BadgeCheck } from 'lucide-react';

View File

@@ -9,7 +9,7 @@ import {
TooltipProvider,
TooltipTrigger,
} from '@repo/shadcn/tooltip';
import { Edit, Trash, User } from 'lucide-react';
import { Edit, Trash } from 'lucide-react';
import { SurveyTable } from '@/feactures/users/schemas/users';
import { useDeleteUser } from '@/feactures/users/hooks/use-mutation-users';
import { AccountPlanModal } from '../user-modal';
@@ -23,7 +23,6 @@ export const CellAction: React.FC<CellActionProps> = ({ data }) => {
const [open, setOpen] = useState(false);
const [edit, setEdit] = useState(false);
const { mutate: deleteUser } = useDeleteUser();
const router = useRouter();
const onConfirm = async () => {
try {

View File

@@ -12,7 +12,6 @@ export default function UserTableAction() {
typeFilter,
searchQuery,
setPage,
setTypeFilter,
setSearchQuery,
} = useSurveyTableFilters();

View File

@@ -1,5 +1,4 @@
'use client';
import { useRouter } from 'next/navigation';
import { Button } from '@repo/shadcn/button';
import { Heading } from '@repo/shadcn/heading';
import { Plus } from 'lucide-react';

View File

@@ -14,9 +14,7 @@ import {
FormLabel,
FormMessage,
} from '@repo/shadcn/form';
import { UpdateUser, updateUser } from '@/feactures/users/schemas/users';
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
interface SelectListProps {
label: string

View File

@@ -46,8 +46,6 @@ export function ModalForm({
const [state, setState] = React.useState(0);
const [municipality, setMunicipality] = React.useState(0);
const [parish, setParish] = React.useState(0);
const [disabledMunicipality, setDisabledMunicipality] = React.useState(true);
const [disabledParish, setDisabledParish] = React.useState(true);

View File

@@ -1,7 +1,7 @@
'use client';
import { useUserByProfile } from '@/feactures/users/hooks/use-query-users';
import { Button } from '@repo/shadcn/button';
import { Edit, Edit2 } from 'lucide-react';
import { Edit2 } from 'lucide-react';
import { useState } from 'react';
import { AccountPlanModal } from './modal-profile';