fix: loading of credential form
This commit is contained in:
parent
be7fa93ffc
commit
6a500edf4d
@ -44,7 +44,7 @@ const ActionList = ({
|
|||||||
setShowSettingAuth(false)
|
setShowSettingAuth(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const { mutate: updatePermission } = useUpdateProviderCredentials({
|
const { mutate: updatePermission, isPending } = useUpdateProviderCredentials({
|
||||||
onSuccess: handleCredentialSettingUpdate,
|
onSuccess: handleCredentialSettingUpdate,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -102,6 +102,7 @@ const ActionList = ({
|
|||||||
credentials: value,
|
credentials: value,
|
||||||
})}
|
})}
|
||||||
onRemove={async () => removePermission(provider.name)}
|
onRemove={async () => removePermission(provider.name)}
|
||||||
|
isSaving={isPending}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,6 +20,7 @@ type Props = {
|
|||||||
onSaved: (value: Record<string, any>) => void
|
onSaved: (value: Record<string, any>) => void
|
||||||
isHideRemoveBtn?: boolean
|
isHideRemoveBtn?: boolean
|
||||||
onRemove?: () => void
|
onRemove?: () => void
|
||||||
|
isSaving?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const ConfigCredential: FC<Props> = ({
|
const ConfigCredential: FC<Props> = ({
|
||||||
@ -28,6 +29,7 @@ const ConfigCredential: FC<Props> = ({
|
|||||||
onSaved,
|
onSaved,
|
||||||
isHideRemoveBtn,
|
isHideRemoveBtn,
|
||||||
onRemove = () => { },
|
onRemove = () => { },
|
||||||
|
isSaving,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const language = useLanguage()
|
const language = useLanguage()
|
||||||
@ -54,8 +56,13 @@ const ConfigCredential: FC<Props> = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
await onSaved(tempCredential)
|
try {
|
||||||
setIsLoading(false)
|
await onSaved(tempCredential)
|
||||||
|
setIsLoading(false)
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
setIsLoading(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -105,7 +112,7 @@ const ConfigCredential: FC<Props> = ({
|
|||||||
}
|
}
|
||||||
< div className='flex space-x-2'>
|
< div className='flex space-x-2'>
|
||||||
<Button onClick={onCancel}>{t('common.operation.cancel')}</Button>
|
<Button onClick={onCancel}>{t('common.operation.cancel')}</Button>
|
||||||
<Button loading={isLoading} disabled={isLoading} variant='primary' onClick={handleSave}>{t('common.operation.save')}</Button>
|
<Button loading={isLoading || isSaving} disabled={isLoading || isSaving} variant='primary' onClick={handleSave}>{t('common.operation.save')}</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
Loading…
Reference in New Issue
Block a user