@@ -35,13 +35,13 @@ import {
3535 setAbbreviation ,
3636 deleteAbbreviation ,
3737 getTeamsProjects ,
38- getAllProjectPreviews
38+ getAllProjects
3939} from '../apis/projects.api' ;
4040import { CreateSingleProjectPayload , EditSingleProjectPayload } from '../utils/types' ;
4141import { useCurrentUser } from './users.hooks' ;
4242
4343/**
44- * Custom React Hook to supply all projects.
44+ * Custom React Hook to supply all projects with Gantt querry args
4545 */
4646export const useAllProjectsGantt = ( ) => {
4747 return useQuery < ProjectGantt [ ] , Error > ( [ 'projects' ] , async ( ) => {
@@ -50,27 +50,39 @@ export const useAllProjectsGantt = () => {
5050 } ) ;
5151} ;
5252
53- export const useAllProjectsPreviews = ( ) => {
53+ /**
54+ * Custom React Hook to supply all projects
55+ */
56+ export const useAllProjects = ( ) => {
5457 return useQuery < ProjectPreview [ ] , Error > ( [ 'projects' , 'previews' ] , async ( ) => {
55- const { data } = await getAllProjectPreviews ( ) ;
58+ const { data } = await getAllProjects ( ) ;
5659 return data ;
5760 } ) ;
5861} ;
5962
63+ /**
64+ * Custom React Hook to supply all of the projects that are on the users teams
65+ */
6066export const useGetUsersTeamsProjects = ( ) => {
6167 return useQuery < ProjectOverview [ ] , Error > ( [ 'projects' , 'teams' ] , async ( ) => {
6268 const { data } = await getUsersTeamsProjects ( ) ;
6369 return data ;
6470 } ) ;
6571} ;
6672
73+ /**
74+ * Custom React Hook to supply all of the projects that the user is the manager or lead of
75+ */
6776export const useGetUsersLeadingProjects = ( ) => {
6877 return useQuery < ProjectOverview [ ] , Error > ( [ 'projects' , 'leading' ] , async ( ) => {
6978 const { data } = await getUsersLeadingProjects ( ) ;
7079 return data ;
7180 } ) ;
7281} ;
7382
83+ /**
84+ * Custom React Hook to supply all of the projects for a given team
85+ */
7486export const useGetTeamsProjects = ( teamId : string ) => {
7587 return useQuery < Project [ ] , Error > ( [ 'projects' , 'teams' ] , async ( ) => {
7688 const { data } = await getTeamsProjects ( teamId ) ;
0 commit comments