api-client/turnstile: don't retry making session if it's not needed
This commit is contained in:
parent
5d7cd861f3
commit
95f0fbdb5e
1 changed files with 10 additions and 7 deletions
|
@ -26,9 +26,11 @@ export class TurnstileCobaltAPI extends CobaltAPI {
|
|||
}
|
||||
|
||||
async request(data: CobaltRequest) {
|
||||
const sessionOrError = await this.#session.getSession();
|
||||
const headers: Record<string, string> = {};
|
||||
|
||||
if (this.#instanceHasTurnstile) {
|
||||
const sessionOrError = await this.#session.getSession();
|
||||
|
||||
if ("error" in sessionOrError) {
|
||||
if (sessionOrError.error.code !== CobaltAuthError.NotConfigured) {
|
||||
return sessionOrError;
|
||||
|
@ -38,6 +40,7 @@ export class TurnstileCobaltAPI extends CobaltAPI {
|
|||
} else {
|
||||
headers['Authorization'] = `Bearer ${sessionOrError.token}`;
|
||||
}
|
||||
}
|
||||
|
||||
return super.request(data, headers);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue