This is an automated email from the ASF dual-hosted git repository.

msciabarra pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/openserverless-vscode-extension.git

commit 176e072df92df26c093de898373dbf6db9c0f3a8
Author: William Grienti <[email protected]>
AuthorDate: Sat Mar 16 20:33:14 2024 +0100

    changed isLoggedIn with nuv -wsk namespace list
---
 src/extension.ts | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/extension.ts b/src/extension.ts
index aaadbdf..8b84c66 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -12,12 +12,13 @@ let context: vscode.ExtensionContext;
 export async function activate(ctx: vscode.ExtensionContext) {
        try {
                context = ctx;
-               const loggedIn = isLoggedIn();
-               if (!loggedIn) LoginPanel.render(handleLogin, 
context.extensionUri);
+               if (!isLoggedIn()) {
+                       LoginPanel.render(handleLogin, context.extensionUri);
+               } 
 
                Object.entries(CliCommands).forEach(([name, command]) =>
                        
context.subscriptions.push(vscode.commands.registerCommand(`nuvolaris.${name.toLowerCase()}`,
 () => {
-                                       if (!loggedIn) {
+                                       if (!isLoggedIn()) {
                                                LoginPanel.render(handleLogin, 
context.extensionUri);
                                                return;
                                        }
@@ -34,13 +35,14 @@ export async function activate(ctx: 
vscode.ExtensionContext) {
        }
 }
 
-function isLoggedIn() {
+function isLoggedIn(): boolean {
        try {
-               return fs.existsSync(os.userInfo().homedir + "/.wskprops");
+               execSync('nuv -wsk namespace list');
+               return true;
        } catch (error) {
-               printError(error);
-               throw error;
+               return false;
        }
+       
 }
 
 function handleLogin(username: string, password: string, apiHost: string) {

Reply via email to