mirror of
https://github.com/formbricks/formbricks.git
synced 2026-02-06 18:59:36 -06:00
22 lines
481 B
TypeScript
22 lines
481 B
TypeScript
import { ReactNode } from "react";
|
|
|
|
import { ErrorComponent } from "../ErrorComponent";
|
|
import LoadingSpinner from "../LoadingSpinner";
|
|
|
|
type AccessWrapperProps = {
|
|
isLoading: boolean;
|
|
children: ReactNode;
|
|
error: string;
|
|
};
|
|
|
|
export const LoadingWrapper = ({ isLoading, children, error }: AccessWrapperProps) => {
|
|
if (isLoading) return <LoadingSpinner />;
|
|
|
|
if (error.length > 0) {
|
|
console.error(error);
|
|
return <ErrorComponent />;
|
|
}
|
|
|
|
return <>{children}</>;
|
|
};
|