Skip to content

Commit cfbba4f

Browse files
committed
feat: Add default callbackURL
1 parent 79f5b63 commit cfbba4f

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

src/pages/IdentityProvider/Create/Coding.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ProForm, ProFormText } from '@ant-design/pro-components';
55

66
import CallbackURL from './CallbackURL';
77
import { FormProps } from './_hooks';
8+
import { getDefaultCallbackURL } from '@/services/system/oauth';
89

910
const INTL = {
1011
CLIENT_ID: {
@@ -90,6 +91,7 @@ export const Coding: React.FC<FormProps> = (props: FormProps) => {
9091
<ProFormText
9192
width="lg"
9293
name="callbackURL"
94+
initialValue={getDefaultCallbackURL()}
9395
fieldProps={{ autoComplete: 'off' }}
9496
label={intl.formatMessage(INTL.CALLBACK_URL)}
9597
tooltip={intl.formatMessage(INTL.CALLBACK_URL_TIPS)}

src/pages/IdentityProvider/Create/GitHub.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import { useIntl } from '@umijs/max';
33
import { ProForm, ProFormText } from '@ant-design/pro-components';
44

5+
import { getDefaultCallbackURL } from '@/services/system/oauth';
56
import CallbackURL from './CallbackURL';
67
import { FormProps } from './_hooks';
78

@@ -57,6 +58,7 @@ export const GitHub: React.FC<FormProps> = (props: FormProps) => {
5758
<ProFormText
5859
width="lg"
5960
name="callbackURL"
61+
initialValue={getDefaultCallbackURL()}
6062
fieldProps={{ autoComplete: 'off' }}
6163
label={intl.formatMessage(INTL.CALLBACK_URL)}
6264
tooltip={intl.formatMessage(INTL.CALLBACK_URL_TIPS)}

src/pages/IdentityProvider/Create/Gitee.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ProForm, ProFormText } from '@ant-design/pro-components';
55

66
import CallbackURL from './CallbackURL';
77
import { FormProps } from './_hooks';
8+
import { getDefaultCallbackURL } from '@/services/system/oauth';
89

910
const INTL = {
1011
CLIENT_ID: {
@@ -76,6 +77,7 @@ export const Gitee: React.FC<FormProps> = (props: FormProps) => {
7677
width="lg"
7778
name="callbackURL"
7879
fieldProps={{ autoComplete: 'off' }}
80+
initialValue={getDefaultCallbackURL()}
7981
label={intl.formatMessage(INTL.CALLBACK_URL)}
8082
tooltip={intl.formatMessage(INTL.CALLBACK_URL_TIPS)}
8183
placeholder={intl.formatMessage(INTL.CALLBACK_URL_PLACEHOLDER)}

src/services/system/oauth.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
import { PageEnum } from '@/enums';
2+
13
export const OAuthCallbackAPI = '/api/v1/oauth/callback/';
24

35
export const getRedirectURL = (name?: string) => {
46
return `${window.location.protocol}//${window.location.host}${OAuthCallbackAPI}${name}`;
57
};
8+
9+
export const getDefaultCallbackURL = () => {
10+
return `${window.location.protocol}//${window.location.host}${PageEnum.BASE_HOME}`;
11+
};

0 commit comments

Comments
 (0)