rewrite typeysation
This commit is contained in:
@@ -1,16 +1,10 @@
|
||||
import { BaseClient } from "@dpu/shared/dist/fastify";
|
||||
import { printNetworkError } from "@dpu/shared/dist/logger.js";
|
||||
import type { AxiosInstance } from "axios";
|
||||
|
||||
export class TidalClient {
|
||||
private axiosInstance: AxiosInstance;
|
||||
|
||||
constructor(axiosInstance: AxiosInstance) {
|
||||
this.axiosInstance = axiosInstance;
|
||||
}
|
||||
|
||||
export class TidalClient extends BaseClient {
|
||||
async get<T>(endpoint: string): Promise<T> {
|
||||
try {
|
||||
const response = await this.axiosInstance.get<T>(`/${endpoint}`);
|
||||
const response = await this.getAxios().get<T>(`/${endpoint}`);
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
@@ -21,7 +15,7 @@ export class TidalClient {
|
||||
|
||||
async post<T>(endpoint: string, data: unknown): Promise<T> {
|
||||
try {
|
||||
const response = await this.axiosInstance.post<T>(`/${endpoint}`, data);
|
||||
const response = await this.getAxios().post<T>(`/${endpoint}`, data);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
printNetworkError(error);
|
||||
|
||||
Reference in New Issue
Block a user