提交
This commit is contained in:
12
src/utils/encrypt.ts
Normal file
12
src/utils/encrypt.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import JSEncrypt from 'jsencrypt';
|
||||
|
||||
const PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
||||
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALDoU+fLIG+nGS5CugznjdUjym6tBIoz
|
||||
CxLmUifF2Sb3MkzgxVvz5k1fDLKlCrztSRDioHaYo+N/co7hIjlpbtECAwEAAQ==
|
||||
-----END PUBLIC KEY-----`;
|
||||
|
||||
export function encryptPassword(password: string) {
|
||||
const encryptor = new JSEncrypt();
|
||||
encryptor.setPublicKey(PUBLIC_KEY);
|
||||
return encryptor.encrypt(password);
|
||||
}
|
||||
@@ -2,7 +2,6 @@ import { createAlova } from 'alova';
|
||||
import VueHook from 'alova/vue';
|
||||
import adapterFetch from 'alova/fetch';
|
||||
import { createAlovaMockAdapter } from '@alova/mock';
|
||||
import { isString } from 'lodash-es';
|
||||
import mocks from './mocks';
|
||||
import { useUser } from '@/store/modules/user';
|
||||
import { storage } from '@/utils/Storage';
|
||||
@@ -77,9 +76,6 @@ export const Alova = createAlova({
|
||||
if (!isUrlStr && urlPrefix) {
|
||||
method.url = `${urlPrefix}${method.url}`;
|
||||
}
|
||||
if (!isUrlStr && apiUrl && isString(apiUrl)) {
|
||||
method.url = `${apiUrl}${method.url}`;
|
||||
}
|
||||
},
|
||||
responded: {
|
||||
onSuccess: async (response, method) => {
|
||||
|
||||
Reference in New Issue
Block a user