@@ -26,7 +26,7 @@ import {
2626 LogStreamsResponse ,
2727 LogStreamView ,
2828} from './types/logs'
29- import { AxiosError } from 'axios'
29+ import axios , { AxiosError } from 'axios'
3030import { UserIdentity } from './auth/types'
3131import { ConfigObject , ConfigTag , PCVersion } from './types/base'
3232import flowRight from 'lodash/flowRight'
@@ -224,13 +224,19 @@ function DeleteCluster(clusterName: any, callback?: Callback) {
224224}
225225
226226async 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 } ` : ''
228230 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 )
230233 var clusters = response . data . clusters
231234 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+ } )
234240 clusters = clusters . concat ( response . data . clusters )
235241 }
236242 setState ( [ 'clusters' , 'list' ] , clusters )
0 commit comments