Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5923769

Browse files
committed
Avoid logging in when no url has been set
To avoid an error like "127.0.0.1:80 ECONNREFUSED". Before we did notlog the error so this did not matter so much but now we do to catchheader issues.
1 parent37118f9 commit5923769

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

‎src/extension.ts‎

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,28 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
7373
vscode.window.registerTreeDataProvider("myWorkspaces",myWorkspacesProvider)
7474
vscode.window.registerTreeDataProvider("allWorkspaces",allWorkspacesProvider)
7575

76-
getAuthenticatedUser()
77-
.then(async(user)=>{
78-
if(user){
79-
vscode.commands.executeCommand("setContext","coder.authenticated",true)
80-
if(user.roles.find((role)=>role.name==="owner")){
81-
awaitvscode.commands.executeCommand("setContext","coder.isOwner",true)
76+
consturl=storage.getURL()
77+
if(url){
78+
getAuthenticatedUser()
79+
.then(async(user)=>{
80+
if(user){
81+
vscode.commands.executeCommand("setContext","coder.authenticated",true)
82+
if(user.roles.find((role)=>role.name==="owner")){
83+
awaitvscode.commands.executeCommand("setContext","coder.isOwner",true)
84+
}
8285
}
83-
}
84-
})
85-
.catch((error)=>{
86-
// This should be a failure to make the request, like the header command
87-
// errored.
88-
vscodeProposed.window.showErrorMessage("Failed to check user authentication: "+error.message)
89-
})
90-
.finally(()=>{
91-
vscode.commands.executeCommand("setContext","coder.loaded",true)
92-
})
86+
})
87+
.catch((error)=>{
88+
// This should be a failure to make the request, like the header command
89+
// errored.
90+
vscodeProposed.window.showErrorMessage("Failed to check user authentication: "+error.message)
91+
})
92+
.finally(()=>{
93+
vscode.commands.executeCommand("setContext","coder.loaded",true)
94+
})
95+
}else{
96+
vscode.commands.executeCommand("setContext","coder.loaded",true)
97+
}
9398

9499
vscode.window.registerUriHandler({
95100
handleUri:async(uri)=>{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp