@@ -16,7 +16,7 @@ const webgwRequestOpts = {
1616/**
1717 * 小程序云Code
1818 */
19- export default class CodeApiService extends AntCodeAPIService {
19+ export default class CodeAPIService extends AntCodeAPIService {
2020 config = CODE_PLATFORM_CONFIG [ CodePlatform . code ] ;
2121
2222 protected async request < T > (
@@ -34,16 +34,14 @@ export default class CodeApiService extends AntCodeAPIService {
3434 baseURL : endpoint ,
3535 credentials : 'include' ,
3636 responseType : 'json' ,
37- ...( privateToken
38- ? {
39- ...options ,
40- headers : {
41- 'PRIVATE-TOKEN' : privateToken ,
42- ...webgwRequestOpts ,
43- ...options ?. headers ,
44- } ,
45- }
46- : options ) ,
37+ ...options ,
38+ ...( {
39+ headers : {
40+ ...( privateToken ? { 'PRIVATE-TOKEN' : privateToken } : { } ) ,
41+ ...options ?. headers ,
42+ ...webgwRequestOpts ,
43+ } ,
44+ } ) ,
4745 } ) ;
4846 return data ;
4947 } catch ( err : any ) {
@@ -58,10 +56,10 @@ export default class CodeApiService extends AntCodeAPIService {
5856 const goto = localize ( 'api.login.goto' ) ;
5957 this . helper
6058 . showMessage (
61- CodePlatform . antcode ,
59+ CodePlatform . code ,
6260 {
6361 type : MessageType . Error ,
64- symbol : 'api.response.no-login-antcode ' ,
62+ symbol : 'api.response.no-login-code ' ,
6563 status : 401 ,
6664 } ,
6765 {
@@ -96,46 +94,11 @@ export default class CodeApiService extends AntCodeAPIService {
9694 }
9795 }
9896
99- private getProjectIdByRepo ( repo : IRepositoryModel ) {
100- return `${ repo . owner } %2F${ repo . name } ` ;
101- }
102-
103- /*
104- * 获取两个分支 的共同祖先
105- * 类似于 git merge-base branch1 branch2
106- * 接口暂时只支持查询两个分支
107- */
108- async mergeBase (
97+ mergeBase (
10998 repo : IRepositoryModel ,
11099 target : string ,
111100 source : string
112101 ) : Promise < API . ResponseCommit > {
113- let url = `/tcloudantcodeweb/api/v4/projects/${ this . getProjectIdByRepo (
114- repo
115- ) } /repository/merge_base?refs[]=${ target } &refs[]=${ source } `;
116- if ( this . config . endpoint ) {
117- url = createUrl ( this . config . endpoint , url ) ;
118- }
119- const urlInstance = new URL ( url , location . origin ) ;
120- const privateToken = this . PRIVATE_TOKEN ;
121- return (
122- await fetch ( urlInstance . toString ( ) , {
123- method : 'GET' ,
124- ...( privateToken
125- ? {
126- headers : {
127- 'PRIVATE-TOKEN' : privateToken ,
128- 'Content-Type' : 'application/json' ,
129- ...webgwRequestOpts
130- } ,
131- }
132- : {
133- headers : {
134- 'Content-Type' : 'application/json' ,
135- ...webgwRequestOpts
136- } ,
137- } ) ,
138- } )
139- ) . json ( ) ;
102+ throw new Error ( 'Method not implemented.' ) ;
140103 }
141104}
0 commit comments