Package cleanup & transition to latest apollo.

This commit is contained in:
Patrick Fic
2021-02-24 08:48:55 -08:00
parent 359edea97c
commit 46014261d6
202 changed files with 31740 additions and 1174 deletions

View File

@@ -1,6 +1,6 @@
import React, { useState } from "react";
import AllocationsAssignmentComponent from "./allocations-assignment.component";
import { useMutation } from "@apollo/react-hooks";
import { useMutation } from "@apollo/client";
import { INSERT_ALLOCATION } from "../../graphql/allocations.queries";
import { useTranslation } from "react-i18next";
import { notification } from "antd";
@@ -8,29 +8,29 @@ import { notification } from "antd";
export default function AllocationsAssignmentContainer({
jobLineId,
hours,
refetch
refetch,
}) {
const visibilityState = useState(false);
const { t } = useTranslation();
const [assignment, setAssignment] = useState({
joblineid: jobLineId,
hours: parseFloat(hours),
employeeid: null
employeeid: null,
});
const [insertAllocation] = useMutation(INSERT_ALLOCATION);
const handleAssignment = () => {
insertAllocation({ variables: { alloc: { ...assignment } } })
.then(r => {
.then((r) => {
notification["success"]({
message: t("allocations.successes.save")
message: t("allocations.successes.save"),
});
visibilityState[1](false);
if (refetch) refetch();
})
.catch(error => {
.catch((error) => {
notification["error"]({
message: t("employees.errors.saving", { message: error.message })
message: t("employees.errors.saving", { message: error.message }),
});
});
};