mirror of https://gitee.com/topiam/eiam
⚡ 优化代码
parent
25a0ca391a
commit
cd6c384f16
|
@ -38,3 +38,10 @@ export async function outLogin() {
|
|||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取加密公钥
|
||||
*/
|
||||
export async function getEncryptSecret(): Promise<API.ApiResult<API.EncryptSecret>> {
|
||||
return request(`/api/v1/public_secret?type=encrypt`);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ declare namespace API {
|
|||
email: string;
|
||||
phone: string;
|
||||
username: string;
|
||||
fullName: string;
|
||||
access: string[];
|
||||
};
|
||||
|
||||
|
@ -66,6 +67,14 @@ declare namespace API {
|
|||
secret: string;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 加密秘钥
|
||||
*/
|
||||
export type EncryptSecret = {
|
||||
secret: string;
|
||||
};
|
||||
|
||||
//= =========================通用API返回=============================//
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,6 +21,7 @@ import { parse } from 'querystring';
|
|||
import { history, matchPath } from '@umijs/max';
|
||||
import YAML from 'yaml';
|
||||
import { PhoneNumber } from 'google-libphonenumber';
|
||||
import { getEncryptSecret } from '@/services';
|
||||
|
||||
export const getPageQuery = () => {
|
||||
const { href } = window.location;
|
||||
|
@ -376,3 +377,14 @@ export function generateUUID() {
|
|||
return v.toString(16);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取加密公钥
|
||||
*/
|
||||
export const onGetEncryptSecret = async (): Promise<undefined | string> => {
|
||||
const { success, result } = await getEncryptSecret();
|
||||
if (success && result) {
|
||||
return Promise.resolve(result.secret);
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue