From 9b3ec5e0186a1ecf81f8074b0e4695cc4ed2d00c Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Wed, 13 Mar 2024 19:53:36 +0000 Subject: [PATCH] [ci] format --- packages/db/src/core/tokens.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/db/src/core/tokens.ts b/packages/db/src/core/tokens.ts index ea284c067c..cee713b144 100644 --- a/packages/db/src/core/tokens.ts +++ b/packages/db/src/core/tokens.ts @@ -33,11 +33,10 @@ class ManagedRemoteAppToken implements ManagedAppToken { static async getRegionCode(): Promise { const pingResponse = await safeFetch(new URL(`${getRemoteDatabaseUrl()}/ping`)); - const pingResult = await pingResponse.json() as {success: true, data: {region: string} }; + const pingResult = (await pingResponse.json()) as { success: true; data: { region: string } }; return pingResult.data.region; } - static async create(sessionToken: string, projectId: string) { const region = await ManagedRemoteAppToken.getRegionCode(); const response = await safeFetch( @@ -64,7 +63,13 @@ class ManagedRemoteAppToken implements ManagedAppToken { }); } - constructor(options: { token: string; session: string; region: string | undefined; projectId: string; ttl: number }) { + constructor(options: { + token: string; + session: string; + region: string | undefined; + projectId: string; + ttl: number; + }) { this.token = options.token; this.session = options.session; this.region = options.region; @@ -82,9 +87,9 @@ class ManagedRemoteAppToken implements ManagedAppToken { Authorization: `Bearer ${this.session}`, 'Content-Type': 'application/json', }, - body: JSON.stringify({...body, region: this.region}), + body: JSON.stringify({ ...body, region: this.region }), }, - () => { + () => { throw new Error(`Failed to fetch ${url}.`); } );