@@ -26,7 +26,7 @@ import {
26
26
LogStreamsResponse ,
27
27
LogStreamView ,
28
28
} from './types/logs'
29
- import { AxiosError } from 'axios'
29
+ import axios , { AxiosError } from 'axios'
30
30
import { UserIdentity } from './auth/types'
31
31
import { ConfigObject , ConfigTag , PCVersion } from './types/base'
32
32
import flowRight from 'lodash/flowRight'
@@ -224,13 +224,19 @@ function DeleteCluster(clusterName: any, callback?: Callback) {
224
224
}
225
225
226
226
async function ListClusters ( ) : Promise < ClusterInfoSummary [ ] > {
227
- var url = 'api?path=/v3/clusters'
227
+ const region = getState ( [ 'app' , 'selectedRegion' ] )
228
+ var url = '/pcui/api?path=/v3/clusters'
229
+ url += region ? `®ion=${ region } ` : ''
228
230
try {
229
- var response = await request ( 'get' , url )
231
+ // Using axios.get instead of request to pass in params, which can handle the special characters in the token
232
+ var response = await axios . get ( url )
230
233
var clusters = response . data . clusters
231
234
while ( 'nextToken' in response . data ) {
232
- const urlToken = `${ url } &nextToken=${ response . data . nextToken } `
233
- response = await request ( 'get' , urlToken )
235
+ response = await axios . get ( url , {
236
+ params : {
237
+ nextToken : encodeURIComponent ( response . data . nextToken ) ,
238
+ } ,
239
+ } )
234
240
clusters = clusters . concat ( response . data . clusters )
235
241
}
236
242
setState ( [ 'clusters' , 'list' ] , clusters )
0 commit comments