File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -970,7 +970,11 @@ export class PawSQLTreeProvider
970970 password : string ;
971971 backendUrl : string ;
972972 } ) {
973- const result = await ApiService . getUserKey ( config . email , config . password ) ;
973+ const result = await ApiService . getUserKey (
974+ config . backendUrl ,
975+ config . email ,
976+ config . password
977+ ) ;
974978 if ( ! result ) {
975979 await vscode . workspace
976980 . getConfiguration ( "pawsql" )
Original file line number Diff line number Diff line change @@ -311,11 +311,11 @@ export const validateUserKey = async (userKey: string): Promise<boolean> => {
311311} ;
312312
313313export const getUserKey = async (
314+ backendUrl : string ,
314315 email : string ,
315316 password : string
316317) : Promise < { apikey : string ; frontendUrl : string } | null > => {
317- const { DOMAIN } = getUrls ( ) ;
318- const url = `${ DOMAIN . Backend } /api/v1/getUserKey` ;
318+ const url = `${ backendUrl } /api/v1/getUserKey` ;
319319
320320 try {
321321 // 发送请求以验证 userKey
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ export class PawSQLExtension {
7070 setTimeout ( ( ) => reject ( new Error ( "请求超时" ) ) , 5000 ) ;
7171 } ) ;
7272
73- const userKeyPromise = ApiService . getUserKey ( email , password ) ;
73+ const userKeyPromise = ApiService . getUserKey ( backendUrl , email , password ) ;
7474
7575 const result = await Promise . race ( [ userKeyPromise , timeout ] ) . catch (
7676 ( error ) => {
Original file line number Diff line number Diff line change @@ -126,19 +126,19 @@ export class WebviewProvider {
126126 }
127127 ) {
128128 try {
129- // These operations need to be awaited as they involve async operations
130- await Promise . all ( [
131- this . treeProvider . updateApikey ( config ) ,
132- this . passwordManager . storePassword ( config . password ) ,
133- vscode . workspace
134- . getConfiguration ( "pawsql" )
135- . update ( "email" , config . email , true ) ,
136- vscode . workspace
137- . getConfiguration ( "pawsql" )
138- . update ( "backendUrl" , config . backendUrl , true ) ,
139- ] ) ;
129+ // 按顺序执行配置更新操作
130+ await vscode . workspace
131+ . getConfiguration ( "pawsql" )
132+ . update ( "email" , config . email , true ) ;
133+ await vscode . workspace
134+ . getConfiguration ( "pawsql" )
135+ . update ( "backendUrl" , config . backendUrl , true ) ;
136+ await this . treeProvider . updateApikey ( config ) ;
137+ await this . passwordManager . storePassword ( config . password ) ;
140138
141139 const result = await this . treeProvider . validatePawSQLConfig ( ) ;
140+
141+ // 发送验证结果
142142 panel . webview . postMessage ( {
143143 command : "validateConfig" ,
144144 validateResult : result ,
You can’t perform that action at this time.
0 commit comments