mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 12:25:05 +03:00
Add the Realtime Authorization Demo --------- Co-authored-by: Wen Bo Xie <5532241+w3b6x9@users.noreply.github.com> Co-authored-by: Wen Bo Xie <wenbo.xie3@gmail.com>
21 lines
495 B
TypeScript
21 lines
495 B
TypeScript
"use client";
|
|
|
|
import { useFormStatus } from "react-dom";
|
|
import { type ComponentProps } from "react";
|
|
|
|
type Props = ComponentProps<"button"> & {
|
|
pendingText?: string;
|
|
};
|
|
|
|
export function SubmitButton({ children, pendingText, ...props }: Props) {
|
|
const { pending, action } = useFormStatus();
|
|
|
|
const isPending = pending && action === props.formAction;
|
|
|
|
return (
|
|
<button {...props} type="submit" aria-disabled={pending}>
|
|
{isPending ? pendingText : children}
|
|
</button>
|
|
);
|
|
}
|