Remove the overrideToken parameter from createOctokit

This was only used from initializeWithToken and only added a completely
separate case to the start of the method, effectively turning it into
two separate implementations. Therefore we can make things simpler by
inlining this case in the one place it is used.
This commit is contained in:
Robert
2022-12-21 14:27:50 +00:00
parent 7e8ce35485
commit 74f10a306e

View File

@@ -48,18 +48,13 @@ export class Credentials {
*/
static async initializeWithToken(overrideToken: string) {
const c = new Credentials();
c.octokit = await c.createOctokit(false, overrideToken);
c.octokit = new Octokit.Octokit({ auth: overrideToken, retry });
return c;
}
private async createOctokit(
createIfNone: boolean,
overrideToken?: string,
): Promise<Octokit.Octokit | undefined> {
if (overrideToken) {
return new Octokit.Octokit({ auth: overrideToken, retry });
}
const session = await vscode.authentication.getSession(
GITHUB_AUTH_PROVIDER_ID,
SCOPES,