From c5b063b9808eb08b394b2afe74e8f78a8b076d98 Mon Sep 17 00:00:00 2001 From: Arik Chakma Date: Wed, 17 Jul 2024 02:44:21 +0600 Subject: [PATCH] feat: add error page --- .../DiscoverRoadmaps/DiscoverError.tsx | 21 +++++++++++++++++++ src/pages/discover.astro | 6 ++---- 2 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 src/components/DiscoverRoadmaps/DiscoverError.tsx diff --git a/src/components/DiscoverRoadmaps/DiscoverError.tsx b/src/components/DiscoverRoadmaps/DiscoverError.tsx new file mode 100644 index 000000000..a18012e13 --- /dev/null +++ b/src/components/DiscoverRoadmaps/DiscoverError.tsx @@ -0,0 +1,21 @@ +import { ErrorIcon } from '../ReactIcons/ErrorIcon'; + +type DiscoverErrorProps = { + message: string; +}; + +export function DiscoverError(props: DiscoverErrorProps) { + const { message } = props; + + return ( +
+ +

+ Oops! Something went wrong +

+

+ {message} +

+
+ ); +} diff --git a/src/pages/discover.astro b/src/pages/discover.astro index 19b94a1a8..dbfee1565 100644 --- a/src/pages/discover.astro +++ b/src/pages/discover.astro @@ -2,6 +2,7 @@ import { roadmapApi } from '../api/roadmap'; import BaseLayout from '../layouts/BaseLayout.astro'; import { DiscoverRoadmaps } from '../components/DiscoverRoadmaps/DiscoverRoadmaps'; +import { DiscoverError } from '../components/DiscoverRoadmaps/DiscoverError'; export const prerender = false; @@ -9,14 +10,11 @@ const roadmapApiClient = roadmapApi(Astro); const { error, response: roadmaps } = await roadmapApiClient.listShowcaseRoadmap(); -console.log('-'.repeat(20)); -console.log(error); -console.log('-'.repeat(20)); - const searchParams = Astro.url.searchParams.toString(); --- + {error && } { roadmaps && (