Shift Clock error handling IO-699

This commit is contained in:
Patrick Fic
2021-02-26 14:55:16 -08:00
parent 3caf02f3f7
commit 7e25ca40b8
8 changed files with 74 additions and 11 deletions

View File

@@ -1,5 +1,7 @@
import { useQuery } from "@apollo/client";
import { Result } from "antd";
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { QUERY_ACTIVE_SHIFT_TIME_TICKETS } from "../../graphql/timetickets.queries";
@@ -28,6 +30,7 @@ export function TimeTicketShiftContainer({
currentUser,
isTechConsole,
}) {
const { t } = useTranslation();
const employeeId = useMemo(() => {
const assoc = bodyshop.associations.filter(
(a) => a.useremail === currentUser.email
@@ -48,6 +51,17 @@ export function TimeTicketShiftContainer({
if (loading) return <LoadingSpinner />;
if (error) return <AlertComponent message={error.message} type="error" />;
if (!employeeId)
return (
<div>
<Result
status="500"
title={t("timetickets.errors.noemployeeforuser")}
subTitle={t("timetickets.errors.noemployeeforuser_sub")}
/>
</div>
);
return (
<div>
{data.timetickets.length > 0 ? (