优化代码

pull/43/head
smallbun 2023-09-08 12:43:12 +08:00
parent cc804d0d2e
commit 7720cc377d
3 changed files with 5 additions and 77 deletions

View File

@ -45,6 +45,7 @@ import QiNiu from './QiNiu';
import Tencent from './Tencent'; import Tencent from './Tencent';
import { Container } from '@/components/Container'; import { Container } from '@/components/Container';
import { useIntl } from '@umijs/max'; import { useIntl } from '@umijs/max';
import { SmsTemplateList } from '@/pages/setting/Message/data';
const layout = { const layout = {
labelCol: { labelCol: {
@ -130,7 +131,7 @@ const TestModal = (props: {
}; };
export default (props: { visible: boolean }) => { export default (props: { visible: boolean }) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const editorFormRef = useRef<EditableFormInstance<SettingAPI.SmsTemplateList>>(); const editorFormRef = useRef<EditableFormInstance<SmsTemplateList>>();
const intl = useIntl(); const intl = useIntl();
const { message, modal } = App.useApp(); const { message, modal } = App.useApp();
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
@ -144,7 +145,7 @@ export default (props: { visible: boolean }) => {
const [enabled, setEnabled] = useState<boolean>(false); const [enabled, setEnabled] = useState<boolean>(false);
const [language, setLanguage] = useState<string>(Language.ZH); const [language, setLanguage] = useState<string>(Language.ZH);
const [editableKeys, setEditableRowKeys] = useState<React.Key[]>(); const [editableKeys, setEditableRowKeys] = useState<React.Key[]>();
const [smsTemplateList, setSmsTemplateList] = useState<SettingAPI.SmsTemplateList[]>(); const [smsTemplateList, setSmsTemplateList] = useState<SmsTemplateList[]>();
const columns: ProColumns[] = [ const columns: ProColumns[] = [
{ {
@ -380,7 +381,7 @@ export default (props: { visible: boolean }) => {
label={intl.formatMessage({ id: 'pages.setting.message.sms_provider.provider' })} label={intl.formatMessage({ id: 'pages.setting.message.sms_provider.provider' })}
rules={[{ required: true }]} rules={[{ required: true }]}
fieldProps={{ fieldProps={{
onChange: async (value) => { onChange: async (value: string) => {
setLoading(true); setLoading(true);
setProvider(value); setProvider(value);
//清理 //清理

View File

@ -422,28 +422,4 @@ declare namespace AppAPI {
template: string; template: string;
remark: string; remark: string;
}; };
/**
*
*/
export type GetApp = {
id: string;
type: string;
name: string;
icon: string;
template: string;
protocol: string;
protocolName: string;
clientId: string;
clientSecret: string;
//sso发起方
initLoginType: string;
//sso登录链接
initLoginUrl: string;
nameIdValueType: string;
//授权范围
authorizationType: string;
enabled: boolean;
remark: string;
};
} }

View File

@ -16,16 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { request } from '@umijs/max'; import { request } from '@umijs/max';
import type { LoginConfig, LoginParamsType, MfaFactor } from './data.d'; import type { LoginConfig, LoginParamsType } from './data.d';
import { stringify } from 'querystring'; import { stringify } from 'querystring';
/**
* Mfa
*/
export async function getMfaFactors(): Promise<API.ApiResult<MfaFactor>> {
return request('/api/v1/login/mfa/factors');
}
/** /**
* *
* *
@ -74,32 +67,6 @@ export async function sendLoginCaptchaOpt(
}); });
} }
/**
* MFA
*/
export async function sendMfaSmsOtp(): Promise<API.ApiResult<boolean>> {
return request(`/api/v1/login/mfa/send`, {
method: 'POST',
data: stringify({ channel: 'sms' }),
skipErrorHandler: true,
}).catch((e) => {
throw e;
});
}
/**
* MFA
*/
export async function sendMfaEmailOtp(): Promise<API.ApiResult<boolean>> {
return request(`/api/v1/login/mfa/send`, {
method: 'POST',
data: stringify({ channel: 'mail' }),
skipErrorHandler: true,
}).catch((e) => {
throw e;
});
}
/** /**
* URL * URL
* *
@ -115,22 +82,6 @@ export async function getDingtalkAuthorizeUrl(
}); });
} }
/**
* URL
*
* @param params
*/
export async function loginMfaValidate(
params: Record<string, any>,
): Promise<API.ApiResult<string>> {
return request(`/api/v1/login/mfa/validate`, {
params: params,
skipErrorHandler: true,
}).catch(({ response: { data } }) => {
return data;
});
}
/** /**
* Idp * Idp
*/ */