Skip to content

Commit 3f15785

Browse files
Crowayorpiske
authored andcommitted
Cast API return type
1 parent 753b8dc commit 3f15785

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

ui/src/Pages/Resources/ResourcesPage.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ import { ResourceReference } from "../../models";
1313
import { useResources } from "../../hooks/api/use-resources";
1414

1515
export const ResourcesPage: React.FC = () => {
16-
const [fetchedData, setFetchedData] = useState<ResourceReference[] | string>(
16+
const [fetchedData, setFetchedData] = useState<ResourceReference[]>(
1717
[]
1818
);
1919
const [isLoading, setIsLoading] = useState(true);
2020
const { listResources } = useResources();
2121

2222
useEffect(() => {
2323
listResources().then((result) => {
24-
setFetchedData(result.data);
24+
setFetchedData(result.data as ResourceReference[]);
2525
setIsLoading(false);
2626
});
2727
}, [listResources]);

ui/src/Pages/Tools/ToolsPage.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { ToolReference } from "../../models";
1212
import { ToolsTable } from "./ToolsTable";
1313

1414
export const ToolsPage: React.FC = () => {
15-
const [fetchedData, setFetchedData] = useState<ToolReference[] | string>([]);
15+
const [fetchedData, setFetchedData] = useState<ToolReference[]>([]);
1616
const [isLoading, setIsLoading] = useState(true);
1717
const [isAddModalOpen, setIsAddModalOpen] = useState(false);
1818
const [isImportModalOpen, setIsImportModalOpen] = useState(false);
@@ -21,7 +21,7 @@ export const ToolsPage: React.FC = () => {
2121

2222
useEffect(() => {
2323
listTools().then((result) => {
24-
setFetchedData(result.data);
24+
setFetchedData(result.data as ToolReference[]);
2525
setIsLoading(false);
2626
});
2727
}, [listTools]);
@@ -43,7 +43,7 @@ export const ToolsPage: React.FC = () => {
4343
setIsAddModalOpen(false);
4444
setErrorMessage(null);
4545
listTools().then((result) => {
46-
setFetchedData(result.data);
46+
setFetchedData(result.data as ToolReference[]);
4747
});
4848
} catch (error) {
4949
console.error("Error adding tool:", error);
@@ -64,15 +64,15 @@ export const ToolsPage: React.FC = () => {
6464
}
6565
setIsImportModalOpen(false);
6666
listTools().then((result) => {
67-
setFetchedData(result.data);
67+
setFetchedData(result.data as ToolReference[]);
6868
});
6969
};
7070

7171
const handleDeleteTool = async (toolName?: string) => {
7272
try {
7373
await removeTool({ tool: toolName });
7474
listTools().then((result) => {
75-
setFetchedData(result.data);
75+
setFetchedData(result.data as ToolReference[]);
7676
});
7777
} catch (error) {
7878
console.error("Error deleting tool:", error);

ui/src/Pages/Tools/ToolsTable.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { FunctionComponent } from "react";
1414
import { ToolReference } from "../../models";
1515

1616
interface ToolListProps {
17-
fetchedData: ToolReference[] | string;
17+
fetchedData: ToolReference[];
1818
onDelete: (toolName?: string) => void;
1919
onImport: () => void;
2020
onAdd: () => void;

0 commit comments

Comments
 (0)