refactor: change the return value of uploadPublicKey as promise<string>
This commit is contained in:
22
src/main.ts
22
src/main.ts
@@ -45,12 +45,20 @@ export class DevStarExtension {
|
||||
// 上传公钥
|
||||
const devstarAPIHandler = new DevstarAPIHandler(this.user)
|
||||
await devstarAPIHandler.uploadUserPublicKey()
|
||||
.then(async (res) => {
|
||||
if (res === "ok") {
|
||||
// 打开项目
|
||||
await this.remoteContainer.firstOpenProject(container_host, container_port, container_username, project_path)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
// 直接打开项目
|
||||
await this.remoteContainer.firstOpenProject(container_host, container_port, container_username, project_path)
|
||||
}
|
||||
await this.remoteContainer.firstOpenProject(container_host, container_port, container_username, project_path)
|
||||
} else if (devstar_username === this.user.getUsernameFromLocal()) {
|
||||
// 如果同用户已经登录,则忽略;
|
||||
|
||||
// 直接打开项目
|
||||
await this.remoteContainer.firstOpenProject(container_host, container_port, container_username, project_path)
|
||||
} else {
|
||||
// 如果不是同用户,可以选择切换用户,或者不切换登录用户,直接打开容器
|
||||
@@ -67,9 +75,17 @@ export class DevStarExtension {
|
||||
// 上传公钥
|
||||
const devstarAPIHandler = new DevstarAPIHandler(this.user)
|
||||
await devstarAPIHandler.uploadUserPublicKey()
|
||||
.then(async (res) => {
|
||||
if (res === "ok") {
|
||||
// 打开项目
|
||||
await this.remoteContainer.firstOpenProject(container_host, container_port, container_username, project_path)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
// 直接打开项目
|
||||
await this.remoteContainer.firstOpenProject(container_host, container_port, container_username, project_path)
|
||||
}
|
||||
await this.remoteContainer.firstOpenProject(container_host, container_port, container_username, project_path)
|
||||
} else if (selection === 'No') {
|
||||
await openProjectWithoutLogging(container_host, container_port, container_username, project_path);
|
||||
}
|
||||
|
Reference in New Issue
Block a user