@@ -19,9 +19,15 @@ import { useNavigate } from 'react-router-dom';
19
19
import { AWSConfig } from './AWSConfig' ;
20
20
import { useIsAwsStepValid } from './validators' ;
21
21
22
- import { changeAWSConfig } from '../../store/cloudProviderConfigSlice' ;
23
- import { useGetWorkerConfigQuery } from '../../store/cockpit/cockpitApi' ;
24
- import { useAppDispatch } from '../../store/hooks' ;
22
+ import {
23
+ changeAWSConfig ,
24
+ selectAWSConfig ,
25
+ } from '../../store/cloudProviderConfigSlice' ;
26
+ import {
27
+ useGetWorkerConfigQuery ,
28
+ useUpdateWorkerConfigMutation ,
29
+ } from '../../store/cockpit/cockpitApi' ;
30
+ import { useAppDispatch , useAppSelector } from '../../store/hooks' ;
25
31
import { resolveRelPath } from '../../Utilities/path' ;
26
32
import { ImageBuilderHeader } from '../sharedComponents/ImageBuilderHeader' ;
27
33
@@ -54,8 +60,10 @@ const ConfigError = ({
54
60
export const CloudProviderConfig = ( ) => {
55
61
const navigate = useNavigate ( ) ;
56
62
const dispatch = useAppDispatch ( ) ;
63
+ const config = useAppSelector ( selectAWSConfig ) ;
57
64
const handleClose = ( ) => navigate ( resolveRelPath ( '' ) ) ;
58
65
66
+ const [ updateConfig ] = useUpdateWorkerConfigMutation ( ) ;
59
67
const { data, error, refetch } = useGetWorkerConfigQuery ( { } ) ;
60
68
const isAwsStepValid = useIsAwsStepValid ( ) ;
61
69
@@ -80,6 +88,10 @@ export const CloudProviderConfig = () => {
80
88
isNextDisabled : ! isAwsStepValid ,
81
89
isBackDisabled : false ,
82
90
onBack : ( ) => navigate ( resolveRelPath ( '' ) ) ,
91
+ onNext : ( ) => {
92
+ updateConfig ( { updateWorkerConfigRequest : { aws : config } } ) ;
93
+ navigate ( resolveRelPath ( '' ) ) ;
94
+ } ,
83
95
} }
84
96
>
85
97
< AWSConfig refetch = { refetch } />
0 commit comments