Skip to content

Commit 2dfd6ce

Browse files
author
Daniel
committed
fix: Fixed the broken authentication flow
1 parent c1218bc commit 2dfd6ce

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/domains/session/session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export async function login(ctx: ClientContext): Promise<void> {
6666
data: {
6767
username: ctx.config.username,
6868
password: ctx.config.password,
69-
domain: ctx.config.broker,
69+
vendor: ctx.config.broker,
7070
},
7171
headers: { "Content-Type": "application/json" },
7272
},

src/utils/retry.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import axios, { type AxiosRequestConfig, type AxiosResponse } from "axios";
1+
import axios, { type AxiosRequestConfig, type AxiosResponse, isAxiosError } from "axios";
22

33
export async function retryRequest(config: AxiosRequestConfig, retries = 3): Promise<AxiosResponse> {
44
for (let attempt = 1; attempt <= retries; attempt++) {
55
try {
66
return await axios(config);
77
} catch (error: unknown) {
88
const message = error instanceof Error ? error.message : "Unknown error";
9-
console.warn(`[dxtrade-api] Attempt ${attempt} failed: ${message}`);
9+
console.warn(`[dxtrade-api] Attempt ${attempt} failed: ${message}`, config.url);
10+
if (isAxiosError(error) && error.response?.status === 429) throw error;
1011
if (attempt === retries) throw error;
1112
await new Promise((res) => setTimeout(res, 1000 * attempt));
1213
}

0 commit comments

Comments
 (0)