mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 09:25:27 +00:00
chore(mobx): remove extra util class
This commit is contained in:
@@ -1,6 +0,0 @@
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
export function deleteKey(object: any, key: string) {
|
|
||||||
const newObject = { ...object };
|
|
||||||
delete newObject[key];
|
|
||||||
return newObject;
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@ import { Session } from "revolt-api/types/Auth";
|
|||||||
import { Nullable } from "revolt.js/dist/util/null";
|
import { Nullable } from "revolt.js/dist/util/null";
|
||||||
|
|
||||||
import Persistent from "../Persistent";
|
import Persistent from "../Persistent";
|
||||||
import { deleteKey } from "../objectUtil";
|
|
||||||
|
|
||||||
interface Data {
|
interface Data {
|
||||||
sessions: Record<string, Session>;
|
sessions: Record<string, Session>;
|
||||||
@@ -60,7 +59,7 @@ export default class Auth implements Persistent<Data> {
|
|||||||
* @param user_id User ID tied to session
|
* @param user_id User ID tied to session
|
||||||
*/
|
*/
|
||||||
removeSession(user_id: string) {
|
removeSession(user_id: string) {
|
||||||
this.sessions = deleteKey(this.sessions, user_id);
|
this.sessions.delete(user_id);
|
||||||
|
|
||||||
if (user_id == this.current) {
|
if (user_id == this.current) {
|
||||||
this.current = null;
|
this.current = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user