Disable next button on error

This commit is contained in:
Arnaud 2024-09-23 18:44:03 +02:00
parent 710fecbda7
commit 55d569bed4
No known key found for this signature in database
GPG Key ID: 69D6CE281FCAE663
2 changed files with 17 additions and 3 deletions

View File

@ -38,7 +38,9 @@ export function AvailabilityCreate({ space }: Props) {
const components = [
AvailabilityForm,
AvailabilityConfirm,
error ? () => <AvailabilityError error={error} /> : AvailabilitySuccess,
error
? () => <AvailabilityError dispatch={dispatch} error={error} />
: AvailabilitySuccess,
];
useEffect(() => {

View File

@ -1,11 +1,23 @@
import { Placeholder } from "@codex-storage/marketplace-ui-components";
import {
Placeholder,
StepperAction,
} from "@codex-storage/marketplace-ui-components";
import { ErrorIcon } from "../ErrorIcon/ErrorIcon";
import { Dispatch, useEffect } from "react";
type Props = {
error: Error;
dispatch: Dispatch<StepperAction>;
};
export function AvailabilityError({ error }: Props) {
export function AvailabilityError({ dispatch, error }: Props) {
useEffect(() => {
dispatch({
isNextEnable: false,
type: "toggle-next",
});
}, [dispatch]);
return (
<Placeholder
Icon={<ErrorIcon />}