Inline the createOctokit method
It's now only used from one place and inlining it doesn't make getOctokit too long to be unclear.
This commit is contained in:
@@ -47,7 +47,16 @@ export class Credentials {
|
||||
return new Credentials(new Octokit.Octokit({ auth: overrideToken, retry }));
|
||||
}
|
||||
|
||||
private async createOctokit(): Promise<Octokit.Octokit> {
|
||||
/**
|
||||
* Creates or returns an instance of Octokit.
|
||||
*
|
||||
* @returns An instance of Octokit.
|
||||
*/
|
||||
async getOctokit(): Promise<Octokit.Octokit> {
|
||||
if (this.octokit) {
|
||||
return this.octokit;
|
||||
}
|
||||
|
||||
const session = await vscode.authentication.getSession(
|
||||
GITHUB_AUTH_PROVIDER_ID,
|
||||
SCOPES,
|
||||
@@ -59,16 +68,4 @@ export class Credentials {
|
||||
retry,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates or returns an instance of Octokit.
|
||||
*
|
||||
* @returns An instance of Octokit.
|
||||
*/
|
||||
async getOctokit(): Promise<Octokit.Octokit> {
|
||||
if (this.octokit) {
|
||||
return this.octokit;
|
||||
}
|
||||
return await this.createOctokit();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user