diff --git a/src/components/composites/extract/index.tsx b/src/components/composites/extract/index.tsx index cd00256..12f18dc 100644 --- a/src/components/composites/extract/index.tsx +++ b/src/components/composites/extract/index.tsx @@ -20,7 +20,8 @@ import {Combobox} from '@/components/ui/combobox' import cities from './_assets/cities.json' 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(), @@ -324,20 +325,20 @@ FormFields.displayName = 'FormFields' function SelectResource() { const [resources, setResources] = useState([]) const [status, setStatus] = useStatus() + const profile = useProfileStore(state => state.profile) const getResources = async () => { setStatus('load') try { const resp = await allResource() if (!resp.success) { - throw new Error('Unable to fetch packages.') + console.log(11111) + throw new Error('获取套餐失败,请稍后再试') } - console.log(resp.data) - setResources(resp.data) + setResources(resp.data ?? []) setStatus('done') } catch (error) { - console.error('Error fetching packages:', error) - toast.error('获取套餐失败,请稍后再试') + toast.error((error as Error).message) setStatus('fail') } } @@ -363,6 +364,11 @@ function SelectResource() { 加载中... + ) : !profile ? ( +
+ + 请先登录账号,去登录 +
) : resources.length === 0 ? (