fixing updates

This commit is contained in:
2024-09-17 10:41:07 -06:00
parent c7f968bb8f
commit 8b7d198044
4 changed files with 19 additions and 15 deletions

View File

@@ -67,7 +67,7 @@ blockquote {
}
code {
@apply font-mono text-sm bg-gray-800 px-1 leading-tight inline-block;
@apply font-mono text-sm bg-gray-800 px-2 py-1 rounded-md leading-tight inline-block;
}
p {
@apply mb-3;

View File

@@ -3,6 +3,7 @@ import { QueryErrorResetBoundary } from "@tanstack/react-query";
import { FC, ReactNode, Suspense } from "react";
import { ErrorBoundary } from "react-error-boundary";
import { Spinner } from "./Spinner";
import toast from "react-hot-toast";
export const SuspenseAndErrorHandling: FC<{ children: ReactNode }> = ({
children,
@@ -12,7 +13,9 @@ export const SuspenseAndErrorHandling: FC<{ children: ReactNode }> = ({
{({ reset }) => (
<ErrorBoundary
onReset={reset}
fallbackRender={(props) => (
fallbackRender={(props) => {
toast.error(getErrorMessage(props.error))
return (
<div className="text-center">
<div className="p-3">{getErrorMessage(props.error)}</div>
<button
@@ -22,7 +25,8 @@ export const SuspenseAndErrorHandling: FC<{ children: ReactNode }> = ({
Try again
</button>
</div>
)}
);
}}
>
<Suspense fallback={<Spinner />}>{children}</Suspense>
</ErrorBoundary>

View File

@@ -12,9 +12,9 @@ const getAllTerms = async () => {
const { data } = await axiosClient.get<
{
enrollment_terms: CanvasEnrollmentTermModel[];
}[]
}
>(url);
const terms = data.flatMap((r) => r.enrollment_terms);
const terms = data.enrollment_terms;
return terms;
};