feat: make login functional again

This commit is contained in:
Paul Makles
2022-06-29 10:52:42 +01:00
parent 8d505c9564
commit 66ae518e51
7 changed files with 160 additions and 140 deletions

View File

@@ -1,13 +1,14 @@
import { action, computed, makeAutoObservable } from "mobx";
import { Client } from "revolt.js";
import { API, Client } from "revolt.js";
type State = "Ready" | "Connecting" | "Online" | "Disconnected" | "Offline";
type Transition =
| {
action: "LOGIN";
session: SessionPrivate;
apiUrl?: string;
session: SessionPrivate;
configuration?: API.RevoltConfig;
}
| {
action:
@@ -113,6 +114,10 @@ export default class Session {
this.state = "Connecting";
this.createClient(data.apiUrl);
if (data.configuration) {
this.client!.configuration = data.configuration;
}
try {
await this.client!.useExistingSession(data.session);
this.user_id = this.client!.user!._id;