1- import { appConfigApiClient as api } from 'lib/api' ;
1+ import {
2+ appConfigApiClient as appConfig ,
3+ internalApiClient as internalApi ,
4+ } from 'lib/api' ;
25import { useMutation , useQuery , useQueryClient } from '@tanstack/react-query' ;
36import {
47 ApplicationConfig ,
@@ -9,15 +12,15 @@ import { QUERY_REFETCH_OFF_OPTIONS } from 'lib/constants';
912export function useAuthSettings ( ) {
1013 return useQuery (
1114 [ 'app' , 'authSettings' ] ,
12- ( ) => api . getAuthenticationSettings ( ) ,
15+ ( ) => appConfig . getAuthenticationSettings ( ) ,
1316 QUERY_REFETCH_OFF_OPTIONS
1417 ) ;
1518}
1619
1720export function useAuthenticate ( ) {
1821 return useMutation ( {
1922 mutationFn : ( params : { username : string ; password : string } ) =>
20- api . authenticateRaw ( params , {
23+ internalApi . authenticateRaw ( params , {
2124 headers : { 'Content-Type' : 'application/x-www-form-urlencoded' } ,
2225 } ) ,
2326 } ) ;
@@ -26,13 +29,13 @@ export function useAuthenticate() {
2629export function useAppInfo ( ) {
2730 return useQuery (
2831 [ 'app' , 'info' ] ,
29- ( ) => api . getApplicationInfoRaw ( ) ,
32+ ( ) => appConfig . getApplicationInfoRaw ( ) ,
3033 QUERY_REFETCH_OFF_OPTIONS
3134 ) ;
3235}
3336
3437export function useAppConfig ( ) {
35- return useQuery ( [ 'app' , 'config' ] , ( ) => api . getCurrentConfig ( ) ) ;
38+ return useQuery ( [ 'app' , 'config' ] , ( ) => appConfig . getCurrentConfig ( ) ) ;
3639}
3740
3841function aggregateClusters (
@@ -64,7 +67,7 @@ export function useUpdateAppConfig({
6467 const client = useQueryClient ( ) ;
6568 return useMutation (
6669 async ( cluster : ApplicationConfigPropertiesKafkaClusters ) => {
67- const existingConfig = await api . getCurrentConfig ( ) ;
70+ const existingConfig = await appConfig . getCurrentConfig ( ) ;
6871
6972 const clusters = aggregateClusters (
7073 cluster ,
@@ -80,7 +83,7 @@ export function useUpdateAppConfig({
8083 kafka : { clusters } ,
8184 } ,
8285 } ;
83- return api . restartWithConfig ( { restartRequest : { config } } ) ;
86+ return appConfig . restartWithConfig ( { restartRequest : { config } } ) ;
8487 } ,
8588 {
8689 onSuccess : ( ) => client . invalidateQueries ( [ 'app' , 'config' ] ) ,
@@ -99,7 +102,7 @@ export function useAppConfigFilesUpload() {
99102
100103export function useValidateAppConfig ( ) {
101104 return useMutation ( ( config : ApplicationConfigPropertiesKafkaClusters ) =>
102- api . validateConfig ( {
105+ appConfig . validateConfig ( {
103106 applicationConfig : { properties : { kafka : { clusters : [ config ] } } } ,
104107 } )
105108 ) ;
0 commit comments