Generic Commit; Most likely a fix or small feature

This commit is contained in:
Darius
2025-11-21 16:22:14 +01:00
parent 5f9b97ca54
commit d0e9f28c8c
4 changed files with 70 additions and 4 deletions

View File

@@ -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,
};
}
}