27 lines
831 B
JavaScript
27 lines
831 B
JavaScript
import React from "react";
|
|
import { useMutation } from "@apollo/react-hooks";
|
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
|
import { Button, notification } from "antd";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
export default function ProductionRemoveButton({ jobId }) {
|
|
const [removeJobFromProduction] = useMutation(UPDATE_JOB);
|
|
const { t } = useTranslation();
|
|
const handleRemoveFromProd = () => {
|
|
removeJobFromProduction({
|
|
variables: { jobId: jobId, job: { inproduction: false } },
|
|
}).catch((error) => {
|
|
notification["error"]({
|
|
message: t("production.errors.removing", {
|
|
error: JSON.stringify(error),
|
|
}),
|
|
});
|
|
});
|
|
};
|
|
return (
|
|
<Button onClick={handleRemoveFromProd} type={"danger"}>
|
|
{t("production.actions.remove")}
|
|
</Button>
|
|
);
|
|
}
|