Skip to content

Commit d7b85cf

Browse files
committed
examples: fix confusing patch example code
This commit updates the patch examples to use getCurrentCluster(). The existing code relied on the current context having the same name as a cluster. Refs: #2168
1 parent 247e4ed commit d7b85cf

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)