Skip to content

Commit cc59961

Browse files
committed
fix: address comments
1 parent f1e5d9e commit cc59961

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/common/atlas/apiClient.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class ApiClient {
6464
return undefined;
6565
}
6666
if (await apiClient.validateToken()) {
67-
request.headers.set("Authorization", `Bearer ${apiClient.token?.access_token}`);
67+
request.headers.set("Authorization", `Bearer ${apiClient.token!.access_token}`);
6868
return request;
6969
}
7070
},
@@ -253,15 +253,17 @@ export class ApiClient {
253253
}
254254

255255
async getIpInfo() {
256-
await this.validateToken();
256+
if (!(await this.validateToken())) {
257+
throw new Error("Not Authenticated");
258+
}
257259

258260
const endpoint = "api/private/ipinfo";
259261
const url = new URL(endpoint, config.apiBaseUrl);
260262
const response = await fetch(url, {
261263
method: "GET",
262264
headers: {
263265
Accept: "application/json",
264-
Authorization: `Bearer ${this.token?.access_token}`,
266+
Authorization: `Bearer ${this.token!.access_token}`,
265267
"User-Agent": config.userAgent,
266268
},
267269
});

src/tools/atlas/createAccessList.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class CreateAccessListTool extends AtlasToolBase {
3939
}));
4040

4141
if (currentIpAddress) {
42-
const currentIp = await this.apiClient!.getIpInfo();
42+
const currentIp = await this.apiClient.getIpInfo();
4343
const input = {
4444
groupId: projectId,
4545
ipAddress: currentIp.currentIpv4Address,

0 commit comments

Comments
 (0)