initila commit

This commit is contained in:
2023-07-26 09:26:55 +02:00
commit 1b208b2ff6
21 changed files with 2524 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import { apiAxiosInstance } from "../service";
export type ReprocessItemValues = {
typeID: number;
buy: number;
buy_reprocess: number;
sell: number;
sell_reprocess: number;
}
export const reprocess = async (items: string, minerals: string, efficiency?: number): Promise<ReprocessItemValues[]> => {
if (!items || !minerals || (efficiency && (efficiency < 0 || efficiency > 1))) {
return [];
}
const itemsJson = JSON.parse(items);
const mineralsJson = JSON.parse(minerals);
const sourceJson = {
"ep_items": itemsJson,
"ep_mat": mineralsJson
};
const source = JSON.stringify(sourceJson);
const response = await apiAxiosInstance.post('/reprocess', source, {params: {efficiency: efficiency ?? 0.55}});
return response.data;
};