File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed
Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,10 @@ export async function createProject( formData : ProjectFormData ) {
1919
2020export async function getProjects ( ) {
2121 try {
22- const { data } = await api ( '/projects' )
22+ const { data } = await api ( '/projects' )
2323 const response = dashboardProjectSchema . safeParse ( data )
24+ console . log ( { response} ) ;
25+
2426 if ( response . success ) return response . data
2527 } catch ( error ) {
2628 if ( isAxiosError ( error ) && error . response ) {
Original file line number Diff line number Diff line change @@ -22,17 +22,19 @@ export const projectSchema = z.object({
2222 _id : z . string ( ) ,
2323 projectName : z . string ( ) ,
2424 clientName : z . string ( ) ,
25- description : z . string ( )
25+ description : z . string ( ) ,
26+ tasks : z . array ( z . object ( ) )
2627} )
2728
2829export const dashboardProjectSchema = z . array (
2930 projectSchema . pick ( {
3031 _id : true ,
3132 projectName : true ,
3233 clientName : true ,
33- description : true
34+ description : true ,
35+ tasks : true
3436 } )
3537)
3638
3739export type Project = z . infer < typeof projectSchema >
38- export type ProjectFormData = Pick < Project , 'clientName' | 'projectName' | 'description' >
40+ export type ProjectFormData = Pick < Project , 'clientName' | 'projectName' | 'description' | 'tasks' >
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export default function DashboardView() {
1313 queryKey :[ 'projects' ] ,
1414 queryFn : getProjects
1515 } )
16-
16+
1717 const queryClient = useQueryClient ( )
1818 const { mutate } = useMutation ( {
1919 mutationFn : deleteProject ,
@@ -59,7 +59,10 @@ if(data) return (
5959 Cliente: { project . clientName }
6060 </ p >
6161 < p className = "text-sm text-gray-400" >
62- { project . description }
62+ Descripcion: { project . description }
63+ </ p >
64+ < p className = "text-sm text-gray-400" >
65+ Tareas: { project . tasks . length }
6366 </ p >
6467 </ div >
6568 </ div >
You can’t perform that action at this time.
0 commit comments