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 response = await safeFetch(
|
||||
new URL(`${getAstroStudioUrl()}/auth/cli/token-create`),
|
||||
|
@ -107,7 +110,7 @@ class ManagedRemoteAppToken implements ManagedAppToken {
|
|||
clearTimeout(this.renewTimer);
|
||||
delete this.renewTimer;
|
||||
|
||||
if(this.tokenIsValid()) {
|
||||
if (this.tokenIsValid()) {
|
||||
const response = await this.fetch('/auth/cli/token-renew', {
|
||||
token: this.token,
|
||||
projectId: this.projectId,
|
||||
|
@ -120,7 +123,10 @@ class ManagedRemoteAppToken implements ManagedAppToken {
|
|||
}
|
||||
} else {
|
||||
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.ttl = ttl;
|
||||
this.expires = getExpiresFromTtl(ttl);
|
||||
|
@ -128,7 +134,9 @@ class ManagedRemoteAppToken implements ManagedAppToken {
|
|||
} catch {
|
||||
// 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.
|
||||
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