优化代码

pull/59/MERGE
awenes 1 year ago
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…
Cancel
Save