28 lines
806 B
TypeScript
28 lines
806 B
TypeScript
![]() |
import * as vscode from 'vscode';
|
||
|
|
||
|
export default class User {
|
||
|
private context:vscode.ExtensionContext;
|
||
|
private usernameKey:string = 'devstarUsername'
|
||
|
private userTokenKey:string = 'devstarUserToken'
|
||
|
|
||
|
constructor(context: vscode.ExtensionContext) {
|
||
|
this.context = context;
|
||
|
}
|
||
|
|
||
|
public getUsernameFromLocal(): string|undefined {
|
||
|
return this.context.globalState.get(this.usernameKey);
|
||
|
}
|
||
|
|
||
|
public getUserTokenFromLocal(): string|undefined{
|
||
|
return this.context.globalState.get(this.userTokenKey);
|
||
|
}
|
||
|
|
||
|
public setUsernameToLocal(username:string) {
|
||
|
this.context.globalState.update(this.usernameKey, username)
|
||
|
}
|
||
|
|
||
|
public setUserTokenToLocal(userToken:string) {
|
||
|
this.context.globalState.update(this.userTokenKey, userToken)
|
||
|
}
|
||
|
|
||
|
}
|