Skip to content

Commit

Permalink
Update Api.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
samss084 authored Feb 2, 2025
1 parent eff9ecd commit f5acd3f
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/model/ApiError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,36 @@ interface Response {
request: Request,
}

interface ErrorResponse {
interface Response {
response: Response
body: any
}

export class ApiError {
export class Api {

statusCode: number
body: any
headers: any
request: Request

constructor(axiosError) {
constructor(axios) {

this.statusCode = axiosError.response.status;
this.body = axiosError.response.data;
this.headers = axiosError.response.headers;
this.statusCode = axios.response.status;
this.body = axios.response.data;
this.headers = axios.response.headers;
this.request = {
url: {
protocol: axiosError.request.protocol,
port: axiosError.request.agent?.defaultPort || axiosError.request.socket?.localPort,
host: axiosError.request.host,
path: axiosError.request.path,
protocol: axios.request.protocol,
port: axios.request.agent?.defaultPort || axios.request.socket?.localPort,
host: axios.request.host,
path: axios.request.path,
},
headers: axiosError.request.getHeaders(),
method: axiosError.request.method
headers: axios.request.getHeaders(),
method: axios.request.method
}
}

generateError(): ErrorResponse {
generate(): Response {
return {
response: {
statusCode: this.statusCode,
Expand Down

0 comments on commit f5acd3f

Please sign in to comment.