From 949ee3b50fc44abda8ee8698766dcc14ac15fe83 Mon Sep 17 00:00:00 2001 From: webdev03 <75148774+webdev03@users.noreply.github.com> Date: Wed, 4 Oct 2023 19:26:35 +1300 Subject: [PATCH] format --- src/classes/CloudConnection.ts | 4 ++-- src/classes/Project.ts | 9 +++++---- src/classes/Studio.ts | 5 +++-- src/classes/forums/Forum.ts | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/classes/CloudConnection.ts b/src/classes/CloudConnection.ts index 2184dfe..b292597 100644 --- a/src/classes/CloudConnection.ts +++ b/src/classes/CloudConnection.ts @@ -47,7 +47,7 @@ class CloudConnection extends events.EventEmitter { const obj = JSON.parse(message || '{"method": "err"}'); if (obj.method == "set") { this.emit("set", { name: obj.name, value: obj.value }); - this.variables.set(obj.name, obj.value) + this.variables.set(obj.name, obj.value); } } }); @@ -93,7 +93,7 @@ class CloudConnection extends events.EventEmitter { const varname = variable.startsWith("☁ ") ? variable.substring(2) : variable; - this.variables.set(`☁ ${varname}`, value.toString()) + this.variables.set(`☁ ${varname}`, value.toString()); if (!this.open) { this.queue.push({ user: this.session.sessionJSON.user.username, diff --git a/src/classes/Project.ts b/src/classes/Project.ts index ce1cf71..258fa80 100644 --- a/src/classes/Project.ts +++ b/src/classes/Project.ts @@ -195,8 +195,9 @@ class Project { } } ); - if(!request.ok) throw Error(`Request failed with status ${request.status}`); - return Number((await request.json())['id']); + if (!request.ok) + throw Error(`Request failed with status ${request.status}`); + return Number((await request.json())["id"]); } /** @@ -348,7 +349,7 @@ class Project { ); if (!request.ok) throw Error(`Request failed with status ${request.status}`); - return (await request.json())['userLove'] as boolean; + return (await request.json())["userLove"] as boolean; } /** @@ -371,7 +372,7 @@ class Project { ); if (!request.ok) throw Error(`Request failed with status ${request.status}`); - return (await request.json())['userFavorite'] as boolean; + return (await request.json())["userFavorite"] as boolean; } /** diff --git a/src/classes/Studio.ts b/src/classes/Studio.ts index 66f78fe..5c27857 100644 --- a/src/classes/Studio.ts +++ b/src/classes/Studio.ts @@ -268,8 +268,9 @@ class Studio { } } ); - if(!request.ok) throw Error(`Request failed with status ${request.status}`); - return Number((await request.json())['id']); + if (!request.ok) + throw Error(`Request failed with status ${request.status}`); + return Number((await request.json())["id"]); } /** diff --git a/src/classes/forums/Forum.ts b/src/classes/forums/Forum.ts index 893a687..00f8435 100644 --- a/src/classes/forums/Forum.ts +++ b/src/classes/forums/Forum.ts @@ -64,7 +64,7 @@ class Forum { } async createTopic(title: string, body: string) { - if(!this.id) throw Error("You need to add a forum id"); + if (!this.id) throw Error("You need to add a forum id"); const form = new FormData(); form.append("csrfmiddlewaretoken", this.session.csrfToken); form.append("name", title); @@ -88,7 +88,7 @@ class Forum { "Cache-Control": "no-cache", "Content-Type": encoder.contentType, Origin: "https://scratch.mit.edu", - Referer: `https://scratch.mit.edu/discuss/${this.id}/topic/add`, + Referer: `https://scratch.mit.edu/discuss/${this.id}/topic/add` } } );