chore(mobx): write jsdoc for auth / mqueue

This commit is contained in:
Paul
2021-12-12 15:47:15 +00:00
parent faca4ac32b
commit fef2c5997f
2 changed files with 31 additions and 2 deletions

View File

@@ -2,8 +2,6 @@ import { action, computed, makeAutoObservable, ObservableMap } from "mobx";
import { Session } from "revolt-api/types/Auth";
import { Nullable } from "revolt.js/dist/util/null";
import { mapToRecord } from "../../lib/conversion";
import Persistent from "../interfaces/Persistent";
import Store from "../interfaces/Store";
@@ -85,10 +83,17 @@ export default class Auth implements Store, Persistent<Data> {
this.sessions.delete(user_id);
}
/**
* Remove current session.
*/
@action logout() {
this.current && this.removeSession(this.current);
}
/**
* Get current session.
* @returns Current session
*/
@computed getSession() {
if (!this.current) return;
return this.sessions.get(this.current)!.session;