Skip to content

Commit 3718aa6

Browse files
authored
Merge pull request #2192 from cjihrig/patch-example
examples: fix confusing patch example code
2 parents 9aa9842 + d7b85cf commit 3718aa6

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

examples/patch-example.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ try {
2525
},
2626
post: async (responseContext) => responseContext,
2727
});
28-
let currentContext = kc.getCurrentContext();
29-
let currentCluster = kc.getCluster(currentContext);
30-
if (currentCluster === undefined || currentCluster === null) {
28+
let currentCluster = kc.getCurrentCluster();
29+
if (currentCluster === null) {
3130
throw new Error('Cluster is undefined');
3231
}
3332
let server = currentCluster.server;

examples/typescript/patch/patch-example.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ try {
3232
},
3333
post: async (responseContext: ResponseContext) => responseContext,
3434
});
35-
const currentContext = kc.getCurrentContext();
36-
const currentCluster = kc.getCluster(currentContext);
37-
if (currentCluster === undefined || currentCluster === null) {
35+
const currentCluster = kc.getCurrentCluster();
36+
if (currentCluster === null) {
3837
throw new Error('Cluster is undefined');
3938
}
4039
const server = currentCluster.server;

0 commit comments

Comments
 (0)