@@ -24,9 +24,9 @@ export default class CodingServer {
24
24
return this . _session ;
25
25
}
26
26
27
- get repo ( ) {
28
- return this . _repo ;
29
- }
27
+ getHeaders = ( token ?: string ) => ( {
28
+ Authorization : `token ${ token || this . _session . accessToken } ` ,
29
+ } ) ;
30
30
31
31
static async getRepoParams ( ) {
32
32
const folders = await hx . workspace . getWorkspaceFolders ( ) ;
@@ -49,9 +49,7 @@ export default class CodingServer {
49
49
const result = await axios ( {
50
50
method : 'get' ,
51
51
url : `https://${ team } .coding.net/api/current_user` ,
52
- params : {
53
- access_token : token ,
54
- } ,
52
+ headers : this . getHeaders ( ) ,
55
53
} ) ;
56
54
57
55
return result ?. data ;
@@ -66,13 +64,13 @@ export default class CodingServer {
66
64
const result = await axios ( {
67
65
method : 'get' ,
68
66
url,
67
+ headers : this . getHeaders ( ) ,
69
68
params : {
70
69
status : `open` ,
71
70
sort : `action_at` ,
72
71
page : 1 ,
73
72
PageSize : 100 ,
74
73
sortDirection : `DESC` ,
75
- access_token : this . _session . accessToken ,
76
74
} ,
77
75
} ) ;
78
76
return result ?. data ?. list || [ ] ;
@@ -87,9 +85,7 @@ export default class CodingServer {
87
85
const result = await axios ( {
88
86
method : 'get' ,
89
87
url : `https://${ team } .coding.net/api/user/${ team } /project/${ project } /repos` ,
90
- params : {
91
- access_token : this . _session . accessToken ,
92
- } ,
88
+ headers : this . getHeaders ( ) ,
93
89
} ) ;
94
90
95
91
return result ?. data ?. depots || [ ] ;
@@ -102,7 +98,8 @@ export default class CodingServer {
102
98
try {
103
99
const result = await axios ( {
104
100
method : 'post' ,
105
- url : `https://${ team } .coding.net/api/team/${ team } /template-project?access_token=${ this . _session . accessToken } ` ,
101
+ url : `https://${ team } .coding.net/api/team/${ team } /template-project` ,
102
+ headers : this . getHeaders ( ) ,
106
103
data : {
107
104
name : project ,
108
105
displayName : project ,
@@ -123,9 +120,10 @@ export default class CodingServer {
123
120
124
121
const result = await axios ( {
125
122
method : 'post' ,
126
- url : `https://${ team } .coding.net/api/user/${ team } /project/${ project } /depot?access_token= ${ this . _session . accessToken } ` ,
123
+ url : `https://${ team } .coding.net/api/user/${ team } /project/${ project } /depot` ,
127
124
headers : {
128
125
'content-type' : 'application/x-www-form-urlencoded;charset=UTF-8' ,
126
+ ...this . getHeaders ( ) ,
129
127
} ,
130
128
data : qs . stringify ( {
131
129
name : depot ,
0 commit comments