Just pass through the auth state

This commit is contained in:
joshaber 2016-05-31 13:57:22 -04:00
parent aa2291b904
commit 369f33a591
2 changed files with 4 additions and 4 deletions

View file

@ -36,8 +36,8 @@ export function requestToken(code: string): Promise<string> {
.then(response => response.access_token) .then(response => response.access_token)
} }
function getOAuthURL(endpoint: string, state: string): string { function getOAuthURL(authState: AuthState): string {
return `${endpoint}/login/oauth/authorize?client_id=${ClientID}&scope=repo&state=${state}` return `${authState.endpoint}/login/oauth/authorize?client_id=${ClientID}&scope=repo&state=${authState.oAuthState}`
} }
export function getDotComEndpoint(): string { export function getDotComEndpoint(): string {
@ -47,7 +47,7 @@ export function getDotComEndpoint(): string {
export function askUserToAuth(endpoint: string) { export function askUserToAuth(endpoint: string) {
authState = {oAuthState: guid(), endpoint} authState = {oAuthState: guid(), endpoint}
shell.openExternal(getOAuthURL(endpoint, authState.oAuthState)) shell.openExternal(getOAuthURL(authState))
} }
export function getToken(username: string): string { export function getToken(username: string): string {

View file

@ -1,7 +1,7 @@
export default class User { export default class User {
public token: string public token: string
public login: string public login: string
public server: string public endpoint: string
public constructor(login: string, token: string) { public constructor(login: string, token: string) {
this.login = login this.login = login