Skip to content

Commit cfccf23

Browse files
committed
fix: 修复 CallbackURL 无法保存问题
1 parent 30b1c02 commit cfccf23

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/pages/IdentityProvider/Create/CallbackURL.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ export const CallbackURL = () => {
2121
return (
2222
<ProFormDependency name={['name']}>
2323
{({ name }) => {
24-
const redirectURL = getRedirectURL(name ? name : `{${intl.formatMessage(INTL.NAME)}}`);
24+
const redirectURL = getRedirectURL(`${name ? name : `{${intl.formatMessage(INTL.NAME)}}`}`);
2525
return (
2626
<ProFormText
27-
width="xl"
27+
width={300}
2828
label={intl.formatMessage(INTL.AUTH_URL)}
2929
name={['config', 'redirectURL']}
3030
readonly
@@ -33,7 +33,11 @@ export const CallbackURL = () => {
3333
proFieldProps={{
3434
render: () => {
3535
return (
36-
<Paragraph copyable={{ text: redirectURL }} style={{ marginBottom: '0' }}>
36+
<Paragraph
37+
editable={{ triggerType: ['text'] }}
38+
copyable={{ text: redirectURL }}
39+
style={{ marginBottom: '0' }}
40+
>
3741
<span
3842
dangerouslySetInnerHTML={{
3943
__html: `<span>${redirectURL}</span>`,

src/pages/IdentityProvider/Create/_hooks.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
UpdateIdentityProviderRequest,
1313
} from '@/services/idp';
1414
import { IdentityProviderType, ProviderCategory } from '@/enums';
15+
import { getRedirectURL } from '@/services/system/oauth';
1516

1617
export type FormType = UpdateIdentityProviderRequest & CreateIdentityProviderRequest;
1718

@@ -81,7 +82,10 @@ export default function useIdentityProviderHook() {
8182
const handleSubmit = async () => {
8283
const values = await formRef.current?.validateFieldsReturnFormatValue?.();
8384
if (values) {
84-
return instanceId ? doUpdateIdp(instanceId, values) : doCreateIdp(values);
85+
if (values.config.redirectURL && !isEdit) {
86+
values.config.redirectURL = getRedirectURL(values.name);
87+
}
88+
return isEdit ? doUpdateIdp(instanceId, values) : doCreateIdp(values);
8589
}
8690
};
8791

0 commit comments

Comments
 (0)