Shift Clock error handling IO-699
This commit is contained in:
@@ -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 ? (
|
||||
|
||||
Reference in New Issue
Block a user