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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user