mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -05:00
[ci] format
This commit is contained in:
parent
37a485b4d1
commit
34206ed60f
1 changed files with 13 additions and 5 deletions
|
@ -44,7 +44,10 @@ class ManagedRemoteAppToken implements ManagedAppToken {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static async createToken(sessionToken: string, projectId: string): Promise<{ token: string; ttl: number; }> {
|
static async createToken(
|
||||||
|
sessionToken: string,
|
||||||
|
projectId: string
|
||||||
|
): Promise<{ token: string; ttl: number }> {
|
||||||
const spinner = ora('Connecting to remote database...').start();
|
const spinner = ora('Connecting to remote database...').start();
|
||||||
const response = await safeFetch(
|
const response = await safeFetch(
|
||||||
new URL(`${getAstroStudioUrl()}/auth/cli/token-create`),
|
new URL(`${getAstroStudioUrl()}/auth/cli/token-create`),
|
||||||
|
@ -120,7 +123,10 @@ class ManagedRemoteAppToken implements ManagedAppToken {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
const { token, ttl } = await ManagedRemoteAppToken.createToken(this.session, this.projectId);
|
const { token, ttl } = await ManagedRemoteAppToken.createToken(
|
||||||
|
this.session,
|
||||||
|
this.projectId
|
||||||
|
);
|
||||||
this.token = token;
|
this.token = token;
|
||||||
this.ttl = ttl;
|
this.ttl = ttl;
|
||||||
this.expires = getExpiresFromTtl(ttl);
|
this.expires = getExpiresFromTtl(ttl);
|
||||||
|
@ -128,7 +134,9 @@ class ManagedRemoteAppToken implements ManagedAppToken {
|
||||||
} catch {
|
} catch {
|
||||||
// If we get here we couldn't create a new token. Since the existing token
|
// If we get here we couldn't create a new token. Since the existing token
|
||||||
// is expired we really can't do anything and should exit.
|
// is expired we really can't do anything and should exit.
|
||||||
throw new Error(`Token has expired and attempts to renew it have failed, please try again.`);
|
throw new Error(
|
||||||
|
`Token has expired and attempts to renew it have failed, please try again.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue