From 924eb96c02976fcc265b72943f783b4d7d63f76c Mon Sep 17 00:00:00 2001 From: WlodekM Date: Fri, 24 Jan 2025 20:05:11 +0200 Subject: no hardcoded username in example --- main.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'main.ts') diff --git a/main.ts b/main.ts index d0f95b9..4949eb1 100644 --- a/main.ts +++ b/main.ts @@ -5,6 +5,15 @@ interface MessageArg { replyTo?: string } +export interface Post { + _id: string, + p: string, + u: string, + e: string, + reply_to: null | string, + post_id: string +} + export default class MAELINK extends EventEmitter { private token: string | null = null; private _ws: WebSocket; @@ -16,7 +25,6 @@ export default class MAELINK extends EventEmitter { } get(path: string, headers: Record = {}) { - console.log(this.http + path); if (this.token) headers = {...headers, token: this.token}; return fetch(this.http + path, { headers, @@ -24,7 +32,6 @@ export default class MAELINK extends EventEmitter { } post(path: string, body: string | object, headers: Record = {}) { - console.log(this.http + path); if (this.token) headers = {...headers, token: this.token}; if (typeof body == "object") { headers['content-type'] = 'application/json' @@ -82,7 +89,7 @@ export default class MAELINK extends EventEmitter { })); } - fetchMessages(offset: number = 0): Promise { + fetchMessages(offset: number = 0): Promise { return new Promise((resolve, reject) => { this._ws.send(JSON.stringify({ cmd: "fetch", -- cgit 1.4.1-2-gfad0