File tree Expand file tree Collapse file tree 4 files changed +758
-541
lines changed
apps/teachers/public/locales/en
libs/shared-lib-v2/src/DynamicForm
mfes/scp-teacher-repo/src/components Expand file tree Collapse file tree 4 files changed +758
-541
lines changed Original file line number Diff line number Diff line change 6363 "YES" : " Yes" ,
6464 "REVIEW_ATTENDANCE" : " Review Attendance" ,
6565 "ADD_NEW" : " Add New" ,
66+ "MAP" : " Map New User" ,
6667 "ADD" : " ADD" ,
6768 "ADD_CENTER" : " Add Centers to your view" ,
6869 "REMOVE_FROM_CENTER" : " Remove From Center" ,
Original file line number Diff line number Diff line change @@ -80,3 +80,58 @@ export const updateUser = async (
8080 return error ;
8181 }
8282} ;
83+ export interface userListParam {
84+ limit ?: number ;
85+ // page: number;
86+ filters : {
87+ role ?: string ;
88+ tenantStatus ?: string ;
89+ states ?: string ;
90+ districts ?: string ;
91+ blocks ?: string ;
92+ } ;
93+ fields ?: any ;
94+ sort ?: object ;
95+ offset ?: number ;
96+ role ?: string ;
97+ customfields ?: any ;
98+ }
99+
100+ export const HierarchicalSearchUserList = async ( {
101+ limit,
102+ offset,
103+ filters,
104+ role,
105+ customfields,
106+ sort,
107+ } : userListParam ) : Promise < any > => {
108+ const apiUrl : string = API_ENDPOINTS . hierarchialSearch ;
109+
110+ const requestBody = {
111+ limit,
112+ offset,
113+ filters,
114+ role,
115+ customfields,
116+ sort,
117+ } ;
118+
119+ try {
120+ const response = await post ( apiUrl , requestBody ) ;
121+ // console.log('response?.data?.result', response?.data?.result?.users);
122+ const result = response ?. data ?. result ;
123+ let returnedResult = { totalCount : result ?. totalCount , getUserDetails : result ?. users } ;
124+ // console.log("returnedResult##", returnedResult)
125+ return returnedResult ;
126+ } catch ( error : any ) {
127+ if ( error . response ) {
128+ if ( error . response . status === 404 ) {
129+ return [ ] ;
130+ }
131+ console . error ( 'API error:' , error . response . status , error . response . data ) ;
132+ } else {
133+ console . error ( 'Network or unknown error:' , error ) ;
134+ console . error ( 'error in getting user list' , error ) ;
135+ }
136+ }
137+ } ;
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ const API_ENDPOINTS = {
7373 contentCreate : `${ baseurl } /tracking/content/create` ,
7474 updateCohortUser : ( userId : string | string [ ] ) => `${ baseurl } /user/v1/cohort/update/${ userId } ` ,
7575 sendMessage : `${ baseurl } /notification/send-raw` ,
76+ hierarchialSearch : `${ baseurl } /user/hierarchical-search` ,
7677} ;
7778
7879export default API_ENDPOINTS ;
You can’t perform that action at this time.
0 commit comments