32 lines
899 B
JavaScript
32 lines
899 B
JavaScript
import { Button, notification } from "antd";
|
|
import axios from "axios";
|
|
import React, { useState } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
export default function JobSendPartPriceChangeComponent({ job }) {
|
|
const { t } = useTranslation();
|
|
const [loading, setLoading] = useState(false);
|
|
const handleClick = async () => {
|
|
setLoading(true);
|
|
try {
|
|
const ppcData = await axios.post("/job/ppc", { jobid: job.id });
|
|
const result = axios.post("http://localhost:1337/ppc/", ppcData.data);
|
|
} catch (error) {
|
|
notification.open({
|
|
type: "error",
|
|
message: t("jobs.errors.partspricechange", {
|
|
error: JSON.stringify(error),
|
|
}),
|
|
});
|
|
} finally {
|
|
setLoading(false);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<Button onClick={handleClick} loading={loading}>
|
|
{t("jobs.actions.sendpartspricechange")}
|
|
</Button>
|
|
);
|
|
}
|