@@ -6,17 +6,25 @@ import { useNavigate } from 'react-router-dom';
6
6
import { AWSConfig } from './AWSConfig' ;
7
7
import { useIsAwsStepValid } from './validators' ;
8
8
9
- import { changeAWSConfig } from '../../store/cloudProviderConfigSlice' ;
10
- import { useGetWorkerConfigQuery } from '../../store/cockpit/cockpitApi' ;
11
- import { useAppDispatch } from '../../store/hooks' ;
9
+ import {
10
+ changeAWSConfig ,
11
+ selectAWSConfig ,
12
+ } from '../../store/cloudProviderConfigSlice' ;
13
+ import {
14
+ useGetWorkerConfigQuery ,
15
+ useUpdateWorkerConfigMutation ,
16
+ } from '../../store/cockpit/cockpitApi' ;
17
+ import { useAppDispatch , useAppSelector } from '../../store/hooks' ;
12
18
import { resolveRelPath } from '../../Utilities/path' ;
13
19
import { ImageBuilderHeader } from '../sharedComponents/ImageBuilderHeader' ;
14
20
15
21
export const CloudProviderConfig = ( ) => {
16
22
const navigate = useNavigate ( ) ;
17
23
const dispatch = useAppDispatch ( ) ;
24
+ const config = useAppSelector ( selectAWSConfig ) ;
18
25
const handleClose = ( ) => navigate ( resolveRelPath ( '' ) ) ;
19
26
27
+ const [ updateConfig ] = useUpdateWorkerConfigMutation ( ) ;
20
28
const { data, error, refetch } = useGetWorkerConfigQuery ( { } ) ;
21
29
const isAwsStepValid = useIsAwsStepValid ( ) ;
22
30
@@ -47,6 +55,10 @@ export const CloudProviderConfig = () => {
47
55
isNextDisabled : ! isAwsStepValid ,
48
56
isBackDisabled : false ,
49
57
onBack : ( ) => navigate ( resolveRelPath ( '' ) ) ,
58
+ onNext : ( ) => {
59
+ updateConfig ( { updateWorkerConfigRequest : { aws : config } } ) ;
60
+ navigate ( resolveRelPath ( '' ) ) ;
61
+ } ,
50
62
} }
51
63
>
52
64
< AWSConfig refetch = { refetch } />
0 commit comments