Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Commit 197f8a9

Browse files
committed
fix product area error
1 parent 711b0c6 commit 197f8a9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/rest/productAreas.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,18 @@ const enrichProductAreaWithAssets = (productArea: any) => {
5454
export const useGetProductArea = (id: string) => {
5555
const [productArea, setProductArea] = useState<any>(null);
5656
const [loading, setLoading] = useState(false);
57-
const [error, setError] = useState(null);
57+
const [error, setError] = useState<any>(undefined);
5858
useEffect(() => {
5959
getProductArea(id).then((res) => res.json())
6060
.then((productAreaDto) => {
61-
setError(null);
61+
setError(undefined);
6262
setProductArea(enrichProductAreaWithAssets(productAreaDto));
6363
})
6464
.catch((err) => {
65-
setError(err);
65+
setError({
66+
message: `Failed to fetch product area, please check the product area ID: ${err.message}`,
67+
status: err.status
68+
});
6669
setProductArea(null);
6770
}).finally(() => {
6871
setLoading(false);

0 commit comments

Comments
 (0)