mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 14:08:11 +00:00
feat: setup the attachment to the passenger clients
This commit is contained in:
@@ -31,7 +31,7 @@ class ApiClient {
|
||||
}
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,15 @@ class ApiClient {
|
||||
return response.data.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* GET without the `{ success, data }` unwrap. Binary endpoints (file streams)
|
||||
* have no envelope to unwrap, so `get` would hand back `undefined`.
|
||||
*/
|
||||
async getRaw<T>(url: string, config?: AxiosRequestConfig): Promise<T> {
|
||||
const response = await this.client.get<T>(url, config);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async post<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T> {
|
||||
const response = await this.client.post<{ success: boolean; data: T }>(url, data, config);
|
||||
return response.data.data;
|
||||
|
||||
Reference in New Issue
Block a user