升级依赖版本并修复构建问题
This commit is contained in:
@@ -22,6 +22,7 @@ import ExtractDocs from '@/components/docs/extract.mdx'
|
||||
import Markdown from '@/components/markdown'
|
||||
import Link from 'next/link'
|
||||
import {useProfileStore} from '@/components/stores-provider'
|
||||
|
||||
const schema = z.object({
|
||||
resource: z.number({required_error: '请选择套餐'}),
|
||||
prov: z.string().optional(),
|
||||
@@ -517,8 +518,10 @@ function ApplyLink() {
|
||||
const form = useFormContext<Schema>()
|
||||
const values = form.watch()
|
||||
|
||||
const type = useRef<'copy' | 'open'>('open')
|
||||
// let type: 'open' | 'copy' = 'open'
|
||||
const type = useRef<'open' | 'copy'>('open')
|
||||
const handler = form.handleSubmit(
|
||||
// eslint-disable-next-line react-hooks/refs
|
||||
async (values: z.infer<typeof schema>) => {
|
||||
const params = link(values)
|
||||
|
||||
@@ -572,6 +575,11 @@ function ApplyLink() {
|
||||
},
|
||||
)
|
||||
|
||||
const submit = (t: 'open' | 'copy') => {
|
||||
type.current = t
|
||||
handler()
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={merge(
|
||||
`flex flex-col gap-4`,
|
||||
@@ -586,23 +594,11 @@ function ApplyLink() {
|
||||
|
||||
{/* 操作 */}
|
||||
<div className="flex gap-4">
|
||||
<Button
|
||||
type="button"
|
||||
onClick={async () => {
|
||||
type.current = 'copy'
|
||||
await handler()
|
||||
}}
|
||||
>
|
||||
<Button type="button" onClick={() => submit('copy')}>
|
||||
<CopyIcon/>
|
||||
<span>复制链接</span>
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={async () => {
|
||||
type.current = 'open'
|
||||
await handler()
|
||||
}}
|
||||
>
|
||||
<Button type="button" onClick={() => submit('open')}>
|
||||
<ExternalLinkIcon/>
|
||||
<span>打开链接</span>
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user