mirror of
https://github.com/withastro/astro.git
synced 2025-03-24 23:21:57 -05:00
[ci] format
This commit is contained in:
parent
189ec47c1e
commit
9b3ec5e018
1 changed files with 10 additions and 5 deletions
|
@ -33,11 +33,10 @@ class ManagedRemoteAppToken implements ManagedAppToken {
|
|||
|
||||
static async getRegionCode(): Promise<string | undefined> {
|
||||
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}.`);
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue