diff options
author | WlodekM <[email protected]> | 2025-01-24 20:05:11 +0200 |
---|---|---|
committer | WlodekM <[email protected]> | 2025-01-24 20:05:11 +0200 |
commit | 924eb96c02976fcc265b72943f783b4d7d63f76c (patch) | |
tree | 16c56d60d0df5baa07f7492a8594b97b5d81aa34 /main.ts | |
parent | dffbe004789b144c76e435a32a8df1d7b58d1f8c (diff) |
Diffstat (limited to 'main.ts')
-rw-r--r-- | main.ts | 13 |
1 files changed, 10 insertions, 3 deletions
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<string, string> = {}) { - 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<string, string> = {}) { - 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<any[]> { + fetchMessages(offset: number = 0): Promise<Post[]> { return new Promise((resolve, reject) => { this._ws.send(JSON.stringify({ cmd: "fetch", |