File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { gql } from '@/gql' ;
2+ import { useRoles } from '@/hooks/useApollo' ;
23import { useQuery } from '@apollo/client' ;
34
45const GET_COOPERATION_STUDENTS_QUERY = gql ( `
@@ -37,9 +38,11 @@ const GET_COOPERATION_LIST = gql(`
3738` ) ;
3839
3940export const useCooperations = ( ) => {
40- const { data : cooperationStudents , refetch : refetchCooperationStudents } = useQuery ( GET_COOPERATION_STUDENTS_QUERY ) ;
41- const { data : pendingCooperationStudentsCountData } = useQuery ( GET_PENDING_COOPERATION_STUDENTS_COUNT_QUERY ) ;
42- const { data : cooperationListData } = useQuery ( GET_COOPERATION_LIST ) ;
41+ const roles = useRoles ( ) ;
42+ const isScreener = roles . includes ( 'STUDENT_SCREENER' ) ;
43+ const { data : cooperationStudents , refetch : refetchCooperationStudents } = useQuery ( GET_COOPERATION_STUDENTS_QUERY , { skip : ! isScreener } ) ;
44+ const { data : pendingCooperationStudentsCountData } = useQuery ( GET_PENDING_COOPERATION_STUDENTS_COUNT_QUERY , { skip : ! isScreener } ) ;
45+ const { data : cooperationListData } = useQuery ( GET_COOPERATION_LIST , { skip : ! isScreener } ) ;
4346
4447 return {
4548 cooperationStudents :
You can’t perform that action at this time.
0 commit comments