fix: Unknown event handler property onsuccess . (#3603)
* chore(version): 1.1.8 * Update OAuthButton.tsx --------- Co-authored-by: kangfenmao <kangfenmao@qq.com>
This commit is contained in:
parent
592484af95
commit
c29cab7daa
@ -9,28 +9,27 @@ interface Props extends ButtonProps {
|
|||||||
onSuccess?: (key: string) => void
|
onSuccess?: (key: string) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const OAuthButton: FC<Props> = ({ provider, ...props }) => {
|
const OAuthButton: FC<Props> = ({ provider, onSuccess, ...buttonProps }) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
||||||
const onAuth = () => {
|
const onAuth = () => {
|
||||||
const onSuccess = (key: string) => {
|
const handleSuccess = (key: string) => {
|
||||||
if (key.trim()) {
|
if (key.trim()) {
|
||||||
props.onSuccess?.(key)
|
onSuccess?.(key)
|
||||||
window.message.success({ content: t('auth.get_key_success'), key: 'auth-success' })
|
window.message.success({ content: t('auth.get_key_success'), key: 'auth-success' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider.id === 'silicon') {
|
if (provider.id === 'silicon') {
|
||||||
oauthWithSiliconFlow(onSuccess)
|
oauthWithSiliconFlow(handleSuccess)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider.id === 'aihubmix') {
|
if (provider.id === 'aihubmix') {
|
||||||
oauthWithAihubmix(onSuccess)
|
oauthWithAihubmix(handleSuccess)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button onClick={onAuth} {...props}>
|
<Button onClick={onAuth} {...buttonProps}>
|
||||||
{t('auth.get_key')}
|
{t('auth.get_key')}
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user