Skip to content

Commit 7fa11eb

Browse files
committed
ARTESCA-16397 - improve the hook
1 parent 0ec2e4b commit 7fa11eb

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

src/js/mutations.test.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,11 @@ describe('mutations', () => {
10971097
});
10981098

10991099
const { result } = renderHook(
1100-
() => useAddCertificateToZenkoConfigurationMutation(true, true),
1100+
() =>
1101+
useAddCertificateToZenkoConfigurationMutation({
1102+
hasEgress: true,
1103+
hasExtraCACerts: true,
1104+
}),
11011105
{
11021106
wrapper: NewWrapper(),
11031107
},
@@ -1140,7 +1144,11 @@ describe('mutations', () => {
11401144
});
11411145

11421146
const { result } = renderHook(
1143-
() => useAddCertificateToZenkoConfigurationMutation(true, false),
1147+
() =>
1148+
useAddCertificateToZenkoConfigurationMutation({
1149+
hasEgress: true,
1150+
hasExtraCACerts: false,
1151+
}),
11441152
{
11451153
wrapper: NewWrapper(),
11461154
},
@@ -1182,7 +1190,11 @@ describe('mutations', () => {
11821190
}),
11831191
});
11841192
const { result } = renderHook(
1185-
() => useAddCertificateToZenkoConfigurationMutation(false, false),
1193+
() =>
1194+
useAddCertificateToZenkoConfigurationMutation({
1195+
hasEgress: false,
1196+
hasExtraCACerts: false,
1197+
}),
11861198
{
11871199
wrapper: NewWrapper(),
11881200
},

src/js/mutations.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,13 @@ const useEnableSOSAPIMutation = () => {
469469
);
470470
};
471471

472-
const useAddCertificateToZenkoConfigurationMutation = (
473-
hasEgress: boolean,
474-
hasExtraCACerts: boolean,
475-
) => {
472+
const useAddCertificateToZenkoConfigurationMutation = ({
473+
hasEgress,
474+
hasExtraCACerts,
475+
}: {
476+
hasEgress: boolean;
477+
hasExtraCACerts: boolean;
478+
}) => {
476479
return usePatchZenkoConfigurationMutation((args: { certificate: string }) => {
477480
const patch = !hasEgress
478481
? [

src/react/truststore/ImportCertificate.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ const ImportCertificate = () => {
5555
);
5656

5757
const addCertificateToZenkoConfigurationMutation =
58-
useAddCertificateToZenkoConfigurationMutation(hasEgress, hasExtraCACerts);
58+
useAddCertificateToZenkoConfigurationMutation({
59+
hasEgress,
60+
hasExtraCACerts,
61+
});
5962

6063
const onSubmit = (data: { certificate: string }) => {
6164
addCertificateToZenkoConfigurationMutation.mutate(

0 commit comments

Comments
 (0)