@@ -49,8 +49,7 @@ import {
4949 ListItemText ,
5050 Avatar
5151} from '@mui/material' ;
52- import axiosServer from '@/utils/axios' ;
53- import { patchAdminAxios } from '@/shared/lib/http/admin-axios-interceptor' ;
52+ import { adminGet } from '@/shared/lib/http/admin-fetch' ;
5453import { useAdminForm } from '@/app/admin/hooks/forms' ;
5554import { gemsFormSchema , type GemsFormData } from '@/app/admin/hooks/forms/schemas/gems.schema' ;
5655import { MAX_GEM_GRANT } from '@/app/admin/constants/gem-limits' ;
@@ -84,10 +83,6 @@ interface BulkGrantResponse {
8483}
8584
8685function GemsManagementPageContent ( ) {
87- useEffect ( ( ) => {
88- const unpatch = patchAdminAxios ( ) ;
89- return unpatch ;
90- } , [ ] ) ;
9186 const toast = useToast ( ) ;
9287 const bulkGrantGems = useBulkGrantGems ( ) ;
9388
@@ -127,21 +122,19 @@ function GemsManagementPageContent() {
127122
128123 try {
129124 const isPhone = / ^ [ \d \- ] + $ / . test ( userSearchTerm . trim ( ) ) ;
130- const response = await axiosServer . get ( '/admin/v2/users/search' , {
131- params : {
132- page : 1 ,
133- limit : 20 ,
134- ...( isPhone ? { phoneNumber : userSearchTerm . trim ( ) } : { name : userSearchTerm . trim ( ) } )
135- }
125+ const response = await adminGet < any > ( '/admin/v2/users/search' , {
126+ page : '1' ,
127+ limit : '20' ,
128+ ...( isPhone ? { phoneNumber : userSearchTerm . trim ( ) } : { name : userSearchTerm . trim ( ) } )
136129 } ) ;
137130
138131 let results : UserSearchResult [ ] = [ ] ;
139- if ( response . data ?. data && Array . isArray ( response . data . data ) ) {
140- results = response . data . data ;
141- } else if ( response . data ?. items && Array . isArray ( response . data . items ) ) {
142- results = response . data . items ;
143- } else if ( Array . isArray ( response . data ) ) {
132+ if ( response ?. data && Array . isArray ( response . data ) ) {
144133 results = response . data ;
134+ } else if ( response ?. items && Array . isArray ( response . items ) ) {
135+ results = response . items ;
136+ } else if ( Array . isArray ( response ) ) {
137+ results = response ;
145138 }
146139
147140 setUserSearchResults ( results ) ;
0 commit comments