Skip to content

Commit

Permalink
컴파일 에러 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
bbanderson committed Jul 31, 2024
1 parent 4172e3b commit 214889d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
20 changes: 9 additions & 11 deletions packages/vscode/src/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,21 @@ export class Credentials {
}

/** Octokit 인스턴스가 없다면, 인증 세션을 새로 만듦으로써, Octokit 인스턴스가 항상 존재하도록 보장한다. */
private async ensureOctokitInstance(): Promise<void> {
if (!this.octokit) {
private async getOctokitInstance(): Promise<Octokit.Octokit> {
if (this.octokit) {
return this.octokit;
} else {
const session = await vscode.authentication.getSession(GITHUB_AUTH_PROVIDER_ID, SCOPES, { createIfNone: true });
this.octokit = await this.createOctokit(session);
return this.octokit;
}
}

async getOctokit(): Promise<Octokit.Octokit | undefined> {
await this.ensureOctokitInstance();
return this.octokit;
async getOctokit(): Promise<Octokit.Octokit> {
return this.getOctokitInstance();
}

async getAuth(): Promise<OctokitAuth | undefined> {
const octokit = await this.getOctokit();
if (octokit) {
return octokit.auth() as Promise<OctokitAuth>;
}
return undefined;
async getAuth(): Promise<OctokitAuth> {
return (await this.getOctokitInstance()).auth() as Promise<OctokitAuth>;
}
}
9 changes: 4 additions & 5 deletions packages/vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as vscode from "vscode";
import { COMMAND_LAUNCH, COMMAND_LOGIN_WITH_GITHUB, COMMAND_RESET_GITHUB_AUTH } from "./commands";
import { Credentials } from "./credentials";
import { GithubTokenUndefinedError, WorkspacePathUndefinedError } from "./errors/ExtensionError";
import { deleteGithubToken, getGithubToken, setGithubToken, } from "./setting-repository";
import { deleteGithubToken, getGithubToken, setGithubToken } from "./setting-repository";
import { mapClusterNodesFrom } from "./utils/csm.mapper";
import {
findGit,
Expand All @@ -18,7 +18,7 @@ import {
import WebviewLoader from "./webview-loader";

let myStatusBarItem: vscode.StatusBarItem;
const projectName = 'githru';
const projectName = "githru";

function normalizeFsPath(fsPath: string) {
return fsPath.replace(/\\/g, "/");
Expand Down Expand Up @@ -58,12 +58,11 @@ export async function activate(context: vscode.ExtensionContext) {

const fetchBranches = async () => await getBranches(gitPath, currentWorkspacePath);
const fetchCurrentBranch = async () => {

let branchName;
try {
branchName = await getCurrentBranchName(gitPath, currentWorkspacePath)
branchName = await getCurrentBranchName(gitPath, currentWorkspacePath);
} catch (error) {
console.error(error);
console.error(error);
}

if (!branchName) {
Expand Down

0 comments on commit 214889d

Please sign in to comment.