1
- import { appConfigApiClient as api } from 'lib/api' ;
1
+ import {
2
+ appConfigApiClient as appConfig ,
3
+ internalApiClient as internalApi ,
4
+ } from 'lib/api' ;
2
5
import { useMutation , useQuery , useQueryClient } from '@tanstack/react-query' ;
3
6
import {
4
7
ApplicationConfig ,
@@ -9,15 +12,15 @@ import { QUERY_REFETCH_OFF_OPTIONS } from 'lib/constants';
9
12
export function useAuthSettings ( ) {
10
13
return useQuery (
11
14
[ 'app' , 'authSettings' ] ,
12
- ( ) => api . getAuthenticationSettings ( ) ,
15
+ ( ) => appConfig . getAuthenticationSettings ( ) ,
13
16
QUERY_REFETCH_OFF_OPTIONS
14
17
) ;
15
18
}
16
19
17
20
export function useAuthenticate ( ) {
18
21
return useMutation ( {
19
22
mutationFn : ( params : { username : string ; password : string } ) =>
20
- api . authenticateRaw ( params , {
23
+ internalApi . authenticateRaw ( params , {
21
24
headers : { 'Content-Type' : 'application/x-www-form-urlencoded' } ,
22
25
} ) ,
23
26
} ) ;
@@ -26,13 +29,13 @@ export function useAuthenticate() {
26
29
export function useAppInfo ( ) {
27
30
return useQuery (
28
31
[ 'app' , 'info' ] ,
29
- ( ) => api . getApplicationInfoRaw ( ) ,
32
+ ( ) => appConfig . getApplicationInfoRaw ( ) ,
30
33
QUERY_REFETCH_OFF_OPTIONS
31
34
) ;
32
35
}
33
36
34
37
export function useAppConfig ( ) {
35
- return useQuery ( [ 'app' , 'config' ] , ( ) => api . getCurrentConfig ( ) ) ;
38
+ return useQuery ( [ 'app' , 'config' ] , ( ) => appConfig . getCurrentConfig ( ) ) ;
36
39
}
37
40
38
41
function aggregateClusters (
@@ -64,7 +67,7 @@ export function useUpdateAppConfig({
64
67
const client = useQueryClient ( ) ;
65
68
return useMutation (
66
69
async ( cluster : ApplicationConfigPropertiesKafkaClusters ) => {
67
- const existingConfig = await api . getCurrentConfig ( ) ;
70
+ const existingConfig = await appConfig . getCurrentConfig ( ) ;
68
71
69
72
const clusters = aggregateClusters (
70
73
cluster ,
@@ -80,7 +83,7 @@ export function useUpdateAppConfig({
80
83
kafka : { clusters } ,
81
84
} ,
82
85
} ;
83
- return api . restartWithConfig ( { restartRequest : { config } } ) ;
86
+ return appConfig . restartWithConfig ( { restartRequest : { config } } ) ;
84
87
} ,
85
88
{
86
89
onSuccess : ( ) => client . invalidateQueries ( [ 'app' , 'config' ] ) ,
@@ -99,7 +102,7 @@ export function useAppConfigFilesUpload() {
99
102
100
103
export function useValidateAppConfig ( ) {
101
104
return useMutation ( ( config : ApplicationConfigPropertiesKafkaClusters ) =>
102
- api . validateConfig ( {
105
+ appConfig . validateConfig ( {
103
106
applicationConfig : { properties : { kafka : { clusters : [ config ] } } } ,
104
107
} )
105
108
) ;
0 commit comments