Generic Commit; Most likely a fix or small feature
This commit is contained in:
@@ -1,4 +1,36 @@
|
||||
import { AxiosInstance } from "axios";
|
||||
|
||||
export type ServiceResult<T = unknown> = {
|
||||
result: T;
|
||||
succesful: boolean;
|
||||
successful: boolean;
|
||||
};
|
||||
|
||||
export abstract class Client {
|
||||
private axiosInstance: AxiosInstance;
|
||||
|
||||
constructor(axiosInstance: AxiosInstance) {
|
||||
this.axiosInstance = axiosInstance;
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class Service<T> {
|
||||
private client: T;
|
||||
|
||||
constructor(client: T) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
getSuccessfulResult<R = unknown>(result: R): ServiceResult<R> {
|
||||
return {
|
||||
result,
|
||||
successful: true,
|
||||
};
|
||||
}
|
||||
|
||||
getErrorResult(error: string): ServiceResult<string> {
|
||||
return {
|
||||
result: error,
|
||||
successful: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user