Skip to content

Commit

Permalink
AUT-2393: Resolve ts error enforcing to implement other missing prope…
Browse files Browse the repository at this point in the history
…rties of AxiosHeaders
  • Loading branch information
ayoshebby committed Apr 26, 2024
1 parent d9d4d3f commit 2a65cdd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/utils/error.ts
Expand Up @@ -9,8 +9,8 @@ export class BadRequestError extends Error {

export class ApiError extends Error {
private status?: number;
private data?: string;
constructor(message: string, status?: number, data?: string) {
private data?: unknown;
constructor(message: string, status?: number, data?: unknown) {
super(message);
this.data = data;
this.status = status;
Expand Down
6 changes: 4 additions & 2 deletions src/utils/http.ts
Expand Up @@ -10,7 +10,9 @@ import { ApiResponseResult } from "../types";
import { HTTP_STATUS_CODES } from "../app.constants";
import { ApiError } from "./error";

const headers: AxiosRequestHeaders = {
interface CustomAxiosRequestHeaders extends Partial<AxiosRequestHeaders> {}

const headers: CustomAxiosRequestHeaders = {
Accept: "application/json",
"Content-Type": "application/json; charset=utf-8",
"Access-Control-Allow-Credentials": "true",
Expand Down Expand Up @@ -97,7 +99,7 @@ export class Http {
apiError = new ApiError(
error.message,
error.response.status,
error.response.data as string
error.response.data
);
} else {
apiError = new ApiError(error.message);
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Expand Up @@ -1816,12 +1816,12 @@ aws-sdk@^2.1356.0:
uuid "8.0.0"
xml2js "0.6.2"

axios@^0.28.0:
version "0.28.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.28.1.tgz#2a7bcd34a3837b71ee1a5ca3762214b86b703e70"
integrity sha512-iUcGA5a7p0mVb4Gm/sy+FSECNkPFT4y7wt6OM/CDpO/OnNCvSs3PoMG8ibrC9jRoGYU0gUK5pXVC4NPXq6lHRQ==
axios@^1.6.8:
version "1.6.8"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.8.tgz#66d294951f5d988a00e87a0ffb955316a619ea66"
integrity sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==
dependencies:
follow-redirects "^1.15.0"
follow-redirects "^1.15.6"
form-data "^4.0.0"
proxy-from-env "^1.1.0"

Expand Down Expand Up @@ -2884,7 +2884,7 @@ flatted@^3.1.0:
resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.4.tgz"
integrity sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==

follow-redirects@^1.15.0:
follow-redirects@^1.15.6:
version "1.15.6"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b"
integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==
Expand Down

0 comments on commit 2a65cdd

Please sign in to comment.