Fortellis logic deduplication

This commit is contained in:
Patrick Fic
2025-12-16 14:30:29 -08:00
parent 7ea81465ee
commit faf00ca845
6 changed files with 131 additions and 30 deletions

View File

@@ -1,4 +1,4 @@
import { Button } from "antd";
import { Button, Space } from "antd";
import axios from "axios";
import { useState } from "react";
import { useTranslation } from "react-i18next";
@@ -42,9 +42,29 @@ export function DmsCdkMakesRefetch({ currentUser, bodyshop }) {
setLoading(false);
};
const handleGetCOA = async () => {
try {
setLoading(true);
await axios.post(`cdk/fortellis/getCOA`, {
cdk_dealerid: bodyshop.cdk_dealerid,
bodyshopid: bodyshop.id
});
} catch (error) {
console.error(error);
}
setLoading(false);
};
return (
<Button loading={loading} onClick={handleRefetch}>
{t("jobs.actions.dms.refetchmakesmodels")}
</Button>
<Space>
<Button loading={loading} onClick={handleRefetch}>
{t("jobs.actions.dms.refetchmakesmodels")}
</Button>
<Button loading={loading} onClick={handleGetCOA}>
Get COA
</Button>
</Space>
);
}