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:
TangZhiZzz 2025-03-19 20:06:31 +08:00 committed by GitHub
parent 592484af95
commit c29cab7daa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,28 +9,27 @@ interface Props extends ButtonProps {
onSuccess?: (key: string) => void
}
const OAuthButton: FC<Props> = ({ provider, ...props }) => {
const OAuthButton: FC<Props> = ({ provider, onSuccess, ...buttonProps }) => {
const { t } = useTranslation()
const onAuth = () => {
const onSuccess = (key: string) => {
const handleSuccess = (key: string) => {
if (key.trim()) {
props.onSuccess?.(key)
onSuccess?.(key)
window.message.success({ content: t('auth.get_key_success'), key: 'auth-success' })
}
}
if (provider.id === 'silicon') {
oauthWithSiliconFlow(onSuccess)
oauthWithSiliconFlow(handleSuccess)
}
if (provider.id === 'aihubmix') {
oauthWithAihubmix(onSuccess)
oauthWithAihubmix(handleSuccess)
}
}
return (
<Button onClick={onAuth} {...props}>
<Button onClick={onAuth} {...buttonProps}>
{t('auth.get_key')}
</Button>
)