fix; correcting the order of function calls

This commit is contained in:
mahiro72 2025-12-12 19:59:26 +09:00
parent 0138cd238a
commit 72544413e2
1 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import AstralButton from "./AstralButton"; import AstralButton from "./AstralButton";
export default function ShareButton({ onShare }: { onShare: () => void }) { export default function ShareButton({ onShare }: { onShare: () => Promise<void> }) {
const [copied, setCopied] = useState(false); const [copied, setCopied] = useState(false);
useEffect(() => { useEffect(() => {
@ -29,9 +29,9 @@ export default function ShareButton({ onShare }: { onShare: () => void }) {
type="button" type="button"
className="relative flex-none leading-6 py-1.5 px-3 shadow-xs disabled:opacity-50" className="relative flex-none leading-6 py-1.5 px-3 shadow-xs disabled:opacity-50"
disabled={copied} disabled={copied}
onClick={() => { onClick={async () => {
await onShare();
setCopied(true); setCopied(true);
onShare();
}} }}
> >
<span <span