From cd041b569371ad0fcac5a5a534f41c3269d3aa90 Mon Sep 17 00:00:00 2001 From: "Eng. Elias" Date: Thu, 7 Mar 2024 17:42:07 +0400 Subject: [PATCH] add some validations on get agents --- src/app/agents/page.tsx | 17 +++++++- src/components/modals/mission_modal.tsx | 43 ++++++++++++++++----- src/components/modals/new_mission_modal.tsx | 43 ++++++++++++++++----- 3 files changed, 83 insertions(+), 20 deletions(-) diff --git a/src/app/agents/page.tsx b/src/app/agents/page.tsx index ac0a164..42f2625 100644 --- a/src/app/agents/page.tsx +++ b/src/app/agents/page.tsx @@ -6,7 +6,7 @@ import { Agent } from "@/types/agent"; import { GET_AGENTS } from "@/utils/graphql_queries"; import { useQuery } from "@apollo/client"; import { Icon } from "@iconify/react"; -import { Button, IconButton } from "@material-tailwind/react"; +import { Alert, Button, IconButton } from "@material-tailwind/react"; import { useState } from "react"; const AgentsPage = () => { @@ -52,7 +52,20 @@ const AgentsPage = () => { />
- {data.agents.map((agent: Agent, i: number) => ( + {error && ( +
+ + } + className="w-fit" + > + {error?.message ?? "An error occurred."} + +
+ )} + {data?.agents.map((agent: Agent, i: number) => (
Crew (Agents):
+ {agentsError && ( + <> +
+ + } + className="w-fit" + > + {agentsError?.message ?? "An error occurred."} + +
+ + )} {isEdit ? ( loading ? (